summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-09-13 13:18:17 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-09-13 16:33:43 +0200
commit03768e7da08c5f37a56b738c61c33b6ed7121a05 (patch)
tree00ef67b9119a9936183d453a408773d2c9d03263 /lib/system
parent99d9526002a16cf8f6ee14943076a7b319d2ceaa (diff)
downloadNim-03768e7da08c5f37a56b738c61c33b6ed7121a05.tar.gz
attempt to fix #4640
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/excpt.nim5
-rw-r--r--lib/system/threads.nim4
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index b89729850..dcf41b67d 100644
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -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:
diff --git a/lib/system/threads.nim b/lib/system/threads.nim
index 838f6e16b..62829f62c 100644
--- a/lib/system/threads.nim
+++ b/lib/system/threads.nim
@@ -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):