C#: Fix crash due to missing gchandle ref null check
This commit is contained in:
parent
9c1768836f
commit
b48dd1bdaf
1 changed files with 1 additions and 1 deletions
|
@ -1189,7 +1189,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
|
||||||
return refcount == 0;
|
return refcount == 0;
|
||||||
Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
|
Ref<MonoGCHandle> &gchandle = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get().gchandle;
|
||||||
|
|
||||||
if (refcount == 1 && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
|
if (refcount == 1 && gchandle.is_valid() && !gchandle->is_weak()) { // The managed side also holds a reference, hence 1 instead of 0
|
||||||
// If owner owner is no longer referenced by the unmanaged side,
|
// If owner owner is no longer referenced by the unmanaged side,
|
||||||
// the managed instance takes responsibility of deleting the owner when GCed.
|
// the managed instance takes responsibility of deleting the owner when GCed.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue