parent
c86f9590fb
commit
6dc34757b6
2 changed files with 28 additions and 4 deletions
|
|
@ -207,10 +207,8 @@ proc nimDecRefIsLast(p: pointer): bool {.compilerRtl, inl.} =
|
|||
|
||||
proc GC_unref*[T](x: ref T) =
|
||||
## New runtime only supports this operation for 'ref T'.
|
||||
if nimDecRefIsLast(cast[pointer](x)):
|
||||
# XXX this does NOT work for virtual destructors!
|
||||
`=destroy`(x[])
|
||||
nimRawDispose(cast[pointer](x), T.alignOf)
|
||||
var y {.cursor.} = x
|
||||
`=destroy`(y)
|
||||
|
||||
proc GC_ref*[T](x: ref T) =
|
||||
## New runtime only supports this operation for 'ref T'.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue