From bb45cc3c7447bfdb513121ee1edd857bda43c81c Mon Sep 17 00:00:00 2001 From: Kawrakow Date: Tue, 10 Mar 2026 18:28:35 +0100 Subject: [PATCH] Arghh (#1397) --- ggml/src/ggml-cuda.cu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ggml/src/ggml-cuda.cu b/ggml/src/ggml-cuda.cu index 3cd505a9..3bd8f1b0 100644 --- a/ggml/src/ggml-cuda.cu +++ b/ggml/src/ggml-cuda.cu @@ -544,6 +544,10 @@ ggml_backend_cuda_context::~ggml_backend_cuda_context() { CUBLAS_CHECK(cublasDestroy(cublas_handles[i])); } } + auto info = const_cast(&ggml_cuda_info()); + if (info->all_ctx[device] == this) { + info->all_ctx[device] = nullptr; + } }