Merge pull request #3243 from yglukhov/gctest-fix
Don't access GCed field in finalizer. Fixes #2305
This commit is contained in:
commit
0a1c5727ee
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")
|
||||
else: result = newCaseNode(caseTree(lvl+1), caseTree(lvl+1))
|
||||
|
||||
proc finalizeBNode(n: TBNode) = writeLine(stdout, n.data)
|
||||
proc finalizeNode(n: PNode) =
|
||||
assert(n != nil)
|
||||
write(stdout, "finalizing: ")
|
||||
if isNil(n.data): writeLine(stdout, "nil!")
|
||||
else: writeLine(stdout, n.data)
|
||||
else: writeLine(stdout, "not nil")
|
||||
|
||||
var
|
||||
id: int = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue