Don't access GCed field in finalizer. Fixes #2305
This commit is contained in:
parent
9b0ac8afa8
commit
2130e9e38f
1 changed files with 7 additions and 8 deletions
|
|
@ -63,12 +63,11 @@ proc caseTree(lvl: int = 0): PCaseNode =
|
||||||
if lvl == 3: result = newCaseNode("data item")
|
if lvl == 3: result = newCaseNode("data item")
|
||||||
else: result = newCaseNode(caseTree(lvl+1), caseTree(lvl+1))
|
else: result = newCaseNode(caseTree(lvl+1), caseTree(lvl+1))
|
||||||
|
|
||||||
proc finalizeBNode(n: TBNode) = writeLine(stdout, n.data)
|
|
||||||
proc finalizeNode(n: PNode) =
|
proc finalizeNode(n: PNode) =
|
||||||
assert(n != nil)
|
assert(n != nil)
|
||||||
write(stdout, "finalizing: ")
|
write(stdout, "finalizing: ")
|
||||||
if isNil(n.data): writeLine(stdout, "nil!")
|
if isNil(n.data): writeLine(stdout, "nil!")
|
||||||
else: writeLine(stdout, n.data)
|
else: writeLine(stdout, "not nil")
|
||||||
|
|
||||||
var
|
var
|
||||||
id: int = 1
|
id: int = 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue