diff options
author | Volodymyr Lashko <volodymyr.lashko@gmail.com> | 2019-11-08 00:00:34 +0200 |
---|---|---|
committer | cooldome <cdome@bk.ru> | 2019-11-07 22:00:34 +0000 |
commit | 4e841ab1564b12c36db84e9a9fc1aae0e7be031b (patch) | |
tree | c17b232e69b768851f7239b69322d418331fbe49 /lib | |
parent | 135e945ff0fcea05f3057b686edd84f86b9014d9 (diff) | |
download | Nim-4e841ab1564b12c36db84e9a9fc1aae0e7be031b.tar.gz |
Fix crash in terminate handler (#12572) [backport]
* fix undefined behavior in terminate handler * fix failing unit test * Revert "fix failing unit test" This reverts commit 0e5e385fbf972d53909347e246a2e9b018fe9906. * Revert "fix undefined behavior in terminate handler" This reverts commit 2b582871f1981492838cc70d30e8c0e00ab8c9a9. * do not throw inside terminate handler with msvc < 1923
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/excpt.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index e3448ff4c..4074002fe 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -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 |