From db9dcbddbc9231d520a14eaa4e256c276273eeb7 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Wed, 26 Jul 2017 20:24:15 +0700 Subject: Forward refcount changes to NativeScriptInstance This also changes Reference::unreference() to always invoke refcount_decremented. Previously it was not invoked until the count reached zero due to short-circuit evalution of boolean expressions. --- core/reference.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/reference.cpp b/core/reference.cpp index c55f8a7fe3..060608eacb 100644 --- a/core/reference.cpp +++ b/core/reference.cpp @@ -74,7 +74,8 @@ bool Reference::unreference() { bool die = refcount.unref(); if (get_script_instance()) { - die = die && get_script_instance()->refcount_decremented(); + bool script_ret = get_script_instance()->refcount_decremented(); + die = die && script_ret; } return die; -- cgit v1.2.3