type Callback = proc() {.closure.}
proc testit(v: ref seq[Callback]) =
var cbc {.cursor.}: Callback
proc cb() =
for c in v[].mitems():
if c == cbc:
reset(c)
reset(cbc) # Commenting this fixes the crash
cbc = cb
v[].add cb
proc run() =
let callbacks = new seq[Callback]
for i in 0..10:
testit(callbacks)
for c in callbacks[]:
c()
run()
/Nim/lib/system/arc.nim(221) nimDestroyAndDispose
/Nim/lib/system/arc.nim(221) nimDestroyAndDispose
/Nim/lib/system/arc.nim(221) nimDestroyAndDispose
/Nim/lib/system/arc.nim nimDecRefIsLast
Error: call depth limit reached in a debug build (2000 function calls). You can change it with -d:nimCallDepthLimit=<int> but really try to avoid deep recursions instead.
Error: execution of an external program failed: 'testit'
Segmentation fault (core dumped)
Nim Version
2.2.10, 0bfb59f
Description
Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response