From d4a080714c1858294d7f59ad2f859c5a71fd44e0 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 26 Feb 2022 17:04:27 +0100 Subject: [PATCH] Release Script owner references before setting it. This hopefully prevents extremely high reference counts. --- src/ScriptResolving/AngelScript/AngelScriptScript.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp index 62131bd..a3bb0ca 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp @@ -24,6 +24,7 @@ AngelScriptScript::AngelScriptScript(const ArbUt::OptionalBorrowedPtr& own THROW("Script was created with owner value, but with unknown owner type.") } auto* handle = GetAngelscriptOwner(); + handle->ReleaseReferences(resolver->GetEngine()); handle->Set(owner.GetValue(), ownerType); } }