Fixes issue where GetAngelscriptOwner would return an invalid value.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-11-05 13:45:51 +01:00
parent d4ece51866
commit 5334ad14da
2 changed files with 52 additions and 17 deletions

View File

@@ -23,10 +23,7 @@ AngelScriptScript::AngelScriptScript(const ArbUt::OptionalBorrowedPtr<void>& own
if (ownerType == nullptr) {
THROW("Script was created with owner value, but with unknown owner type.")
}
CScriptHandle* handle = nullptr;
AngelScriptUtils::AngelscriptFunctionCall(
_type->GetGetOwner().Function, _ctxPool, _obj, _resolver, GetName(), [&](asIScriptContext*) {},
[&](asIScriptContext* ctx) { handle = (CScriptHandle*)ctx->GetReturnAddress(); });
auto* handle = GetAngelscriptOwner();
handle->Set(owner.GetValue(), ownerType);
}
}
@@ -35,7 +32,7 @@ CScriptHandle* AngelScriptScript::GetAngelscriptOwner() {
CScriptHandle* handle = nullptr;
AngelScriptUtils::AngelscriptFunctionCall(
_type->GetGetOwner().Function, _ctxPool, _obj, _resolver, GetName(), [&](asIScriptContext*) {},
[&](asIScriptContext* ctx) { handle = (CScriptHandle*)ctx->GetReturnObject(); });
[&](asIScriptContext* ctx) { handle = (CScriptHandle*)ctx->GetReturnAddress(); });
return handle;
}