Browse Source

Merge pull request #92722 from rune-scape/fix-callable-crash

Fix callable not clearing freed pointer
Rémi Verschelde 1 year ago
parent
commit
7b63ac488e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      core/variant/callable.cpp

+ 2 - 0
core/variant/callable.cpp

@@ -324,6 +324,7 @@ void Callable::operator=(const Callable &p_callable) {
 
 
 		if (custom->ref_count.unref()) {
 		if (custom->ref_count.unref()) {
 			memdelete(custom);
 			memdelete(custom);
+			custom = nullptr;
 		}
 		}
 	}
 	}
 
 
@@ -428,6 +429,7 @@ Callable::~Callable() {
 	if (is_custom()) {
 	if (is_custom()) {
 		if (custom->ref_count.unref()) {
 		if (custom->ref_count.unref()) {
 			memdelete(custom);
 			memdelete(custom);
+			custom = nullptr;
 		}
 		}
 	}
 	}
 }
 }