Fix possible double free memory on exit

This commit is contained in:
Konstantin Zaitsev 2019-09-12 14:50:02 +07:00 • committed by Ruslan Mustakov
commit f45281f5a0
2 changed files with 3 additions and 3 deletions

View file

@ -1,4 +1,4 @@
version = "0.7.19"
version = "0.7.20"
author = "Xored Software, Inc."
description = "Godot Engine bindings"
license = "MIT"

View file

@ -189,8 +189,8 @@ proc nimGodotObjectFinalizer*[T: NimGodotObject](obj: T) =
if obj.godotObject.isNil or obj.isNative: return
# important to set it before so that ``unreference`` is aware
obj.isFinalized = true
if obj.isRef and obj.godotObject.unreference() or
not obj.linkedObject.isNil:
if (obj.isRef or not obj.linkedObject.isNil and obj.linkedObject.isRef) and
obj.godotObject.unreference():
obj.deinit()
macro baseNativeType(T: typedesc): cstring =