mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
Fix crash in terminate handler (#12572) [backport]
* fix undefined behavior in terminate handler * fix failing unit test * Revert "fix failing unit test" This reverts commit0e5e385fbf. * Revert "fix undefined behavior in terminate handler" This reverts commit2b582871f1. * do not throw inside terminate handler with msvc < 1923
This commit is contained in:
committed by
cooldome
parent
135e945ff0
commit
4e841ab156
@@ -484,7 +484,9 @@ when defined(cpp) and appType != "lib" and
|
||||
|
||||
var msg = "Unknown error in unexpected exception handler"
|
||||
try:
|
||||
{.emit"#if !defined(_MSC_VER) || (_MSC_VER >= 1923)".}
|
||||
raise
|
||||
{.emit"#endif".}
|
||||
except Exception:
|
||||
msg = currException.getStackTrace() & "Error: unhandled exception: " &
|
||||
currException.msg & " [" & $currException.name & "]"
|
||||
@@ -493,6 +495,10 @@ when defined(cpp) and appType != "lib" and
|
||||
except:
|
||||
msg = "Error: unhandled unknown cpp exception"
|
||||
|
||||
{.emit"#if defined(_MSC_VER) && (_MSC_VER < 1923)".}
|
||||
msg = "Error: unhandled unknown cpp exception"
|
||||
{.emit"#endif".}
|
||||
|
||||
when defined(genode):
|
||||
# stderr not available by default, use the LOG session
|
||||
echo msg
|
||||
|
||||
Reference in New Issue
Block a user