Fix possible double free memory on exit
This commit is contained in:
parent
db4bb91765
commit
f45281f5a0
2 changed files with 3 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
version = "0.7.19"
|
version = "0.7.20"
|
||||||
author = "Xored Software, Inc."
|
author = "Xored Software, Inc."
|
||||||
description = "Godot Engine bindings"
|
description = "Godot Engine bindings"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,8 @@ proc nimGodotObjectFinalizer*[T: NimGodotObject](obj: T) =
|
||||||
if obj.godotObject.isNil or obj.isNative: return
|
if obj.godotObject.isNil or obj.isNative: return
|
||||||
# important to set it before so that ``unreference`` is aware
|
# important to set it before so that ``unreference`` is aware
|
||||||
obj.isFinalized = true
|
obj.isFinalized = true
|
||||||
if obj.isRef and obj.godotObject.unreference() or
|
if (obj.isRef or not obj.linkedObject.isNil and obj.linkedObject.isRef) and
|
||||||
not obj.linkedObject.isNil:
|
obj.godotObject.unreference():
|
||||||
obj.deinit()
|
obj.deinit()
|
||||||
|
|
||||||
macro baseNativeType(T: typedesc): cstring =
|
macro baseNativeType(T: typedesc): cstring =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue