mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 14:25:23 +00:00
attempt to fix #4640
This commit is contained in:
@@ -2923,14 +2923,14 @@ when not defined(JS): #and not defined(nimscript):
|
||||
## allows you to override the behaviour of your application when CTRL+C
|
||||
## is pressed. Only one such hook is supported.
|
||||
|
||||
proc writeStackTrace*() {.tags: [WriteIOEffect].}
|
||||
proc writeStackTrace*() {.tags: [WriteIOEffect], gcsafe.}
|
||||
## writes the current stack trace to ``stderr``. This is only works
|
||||
## for debug builds.
|
||||
when hostOS != "standalone":
|
||||
proc getStackTrace*(): string
|
||||
proc getStackTrace*(): string {.gcsafe.}
|
||||
## gets the current stack trace. This only works for debug builds.
|
||||
|
||||
proc getStackTrace*(e: ref Exception): string
|
||||
proc getStackTrace*(e: ref Exception): string {.gcsafe.}
|
||||
## gets the stack trace associated with `e`, which is the stack that
|
||||
## lead to the ``raise`` statement. This only works for debug builds.
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
# use the heap (and nor exceptions) do not include the GC or memory allocator.
|
||||
|
||||
var
|
||||
errorMessageWriter*: (proc(msg: string) {.tags: [WriteIOEffect], benign.})
|
||||
errorMessageWriter*: (proc(msg: string) {.tags: [WriteIOEffect], benign,
|
||||
nimcall.})
|
||||
## Function that will be called
|
||||
## instead of stdmsg.write when printing stacktrace.
|
||||
## Unstable API.
|
||||
@@ -26,7 +27,7 @@ else:
|
||||
proc writeToStdErr(msg: cstring) =
|
||||
discard MessageBoxA(0, msg, nil, 0)
|
||||
|
||||
proc showErrorMessage(data: cstring) =
|
||||
proc showErrorMessage(data: cstring) {.gcsafe.} =
|
||||
if errorMessageWriter != nil:
|
||||
errorMessageWriter($data)
|
||||
else:
|
||||
|
||||
@@ -331,7 +331,9 @@ else:
|
||||
when TArg is void:
|
||||
thrd.dataFn()
|
||||
else:
|
||||
thrd.dataFn(thrd.data)
|
||||
var x: TArg
|
||||
deepCopy(x, thrd.data)
|
||||
thrd.dataFn(x)
|
||||
|
||||
proc threadProcWrapStackFrame[TArg](thrd: ptr Thread[TArg]) =
|
||||
when defined(boehmgc):
|
||||
|
||||
Reference in New Issue
Block a user