mirror of
https://github.com/likelovewant/ollama-for-amd.git
synced 2025-12-21 22:33:56 +00:00
harden uncaught exception registration (#12120)
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Hiltgen <daniel@ollama.com>
|
||||||
|
Date: Fri, 29 Aug 2025 16:53:08 -0700
|
||||||
|
Subject: [PATCH] harden uncaught exception registration
|
||||||
|
|
||||||
|
---
|
||||||
|
ggml/src/ggml.cpp | 8 ++++++--
|
||||||
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ggml/src/ggml.cpp b/ggml/src/ggml.cpp
|
||||||
|
index 0d388d45..f5bcb446 100644
|
||||||
|
--- a/ggml/src/ggml.cpp
|
||||||
|
+++ b/ggml/src/ggml.cpp
|
||||||
|
@@ -19,8 +19,12 @@ static bool ggml_uncaught_exception_init = []{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const auto prev{std::get_terminate()};
|
||||||
|
- GGML_ASSERT(prev != ggml_uncaught_exception);
|
||||||
|
- previous_terminate_handler = prev;
|
||||||
|
+ // GGML_ASSERT(prev != ggml_uncaught_exception);
|
||||||
|
+ if (prev != ggml_uncaught_exception) {
|
||||||
|
+ previous_terminate_handler = prev;
|
||||||
|
+ } else {
|
||||||
|
+ GGML_LOG_WARN("%s double registration of ggml_uncaught_exception\n", __func__);
|
||||||
|
+ }
|
||||||
|
std::set_terminate(ggml_uncaught_exception);
|
||||||
|
return true;
|
||||||
|
}();
|
||||||
8
ml/backend/ggml/ggml/src/ggml.cpp
vendored
8
ml/backend/ggml/ggml/src/ggml.cpp
vendored
@@ -19,8 +19,12 @@ static bool ggml_uncaught_exception_init = []{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto prev{std::get_terminate()};
|
const auto prev{std::get_terminate()};
|
||||||
GGML_ASSERT(prev != ggml_uncaught_exception);
|
// GGML_ASSERT(prev != ggml_uncaught_exception);
|
||||||
previous_terminate_handler = prev;
|
if (prev != ggml_uncaught_exception) {
|
||||||
|
previous_terminate_handler = prev;
|
||||||
|
} else {
|
||||||
|
GGML_LOG_WARN("%s double registration of ggml_uncaught_exception\n", __func__);
|
||||||
|
}
|
||||||
std::set_terminate(ggml_uncaught_exception);
|
std::set_terminate(ggml_uncaught_exception);
|
||||||
return true;
|
return true;
|
||||||
}();
|
}();
|
||||||
|
|||||||
Reference in New Issue
Block a user