Closed qqtop closed 3 years ago
# test.nim # simplified example to show issue with msgbox if compiled with --gc:arc/orc import nigui import nigui/msgbox app.init() var window = newWindow() window.width = 1280 window.height = 800 window.onCloseClick = proc(event: CloseClickEvent) = case window.msgBox("你想退出吗 ?", " 退出?", " Leave ", " Minimize ", " Abort ") of 1: window.dispose() of 2: window.minimize() else: discard proc main() = var postflag = false if window.msgBox("Post new record ?", "Post ? ", "Yes", "Abort / 取消 ") == 1: postflag = true else: postflag = false echo postflag when isMainModule: window.show() main() app.run()
works as expected with nim c -r test.nim fails with nim c --gc:arc -r test.nim
part of the trace:
/home/lxuser/.nimble/pkgs/nigui-0.2.4/nigui/msgbox.nim(81) msgBox /home/lxuser/.nimble/pkgs/nigui-0.2.4/nigui.nim(1114) sleep /home/lxuser/.nimble/pkgs/nigui-0.2.4/nigui/private/gtk3/platform_impl.nim(362) processEvents /home/lxuser/.nimble/pkgs/nigui-0.2.4/nigui/private/gtk3/platform_impl.nim(304) pControlButtonReleaseSignal /home/lxuser/.nimble/pkgs/nigui-0.2.4/nigui.nim(821) handleClickEvent /home/lxuser/.nimble/pkgs/nigui-0.2.4/nigui.nim(1883) handleClickEvent /home/lxuser/.choosenim/toolchains/nim-#devel/lib/system.nim(866) buttonClick /home/lxuser/.choosenim/toolchains/nim-#devel/lib/system/arc.nim(172) nimDestroyAndDispose /home/lxuser/.choosenim/toolchains/nim-#devel/lib/system/arc.nim(172) nimDestroyAndDispose
compiling with -d:useMalloc it says malloc(): unsorted double linked list corrupted
works now (probably was broken because of https://github.com/nim-lang/Nim/issues/17003)
As Yardanico wrote, it works with Nim 1.4.4.
works as expected with nim c -r test.nim fails with nim c --gc:arc -r test.nim
part of the trace:
compiling with -d:useMalloc it says malloc(): unsorted double linked list corrupted