Fix crash on exit when C# code was bound to asset unloading event called after C# shutdown

This commit is contained in:
Wojtek Figat
2025-11-18 18:00:02 +01:00
parent 3efb981f00
commit c0dda45c7b
4 changed files with 14 additions and 1 deletions

View File

@@ -316,7 +316,8 @@ bool MCore::LoadEngine()
char* buildInfo = CallStaticMethod<char*>(GetStaticMethodPointer(TEXT("GetRuntimeInformation")));
LOG(Info, ".NET runtime version: {0}", ::String(buildInfo));
MCore::GC::FreeMemory(buildInfo);
GC::FreeMemory(buildInfo);
Ready = true;
return false;
}
@@ -327,6 +328,7 @@ void MCore::UnloadEngine()
return;
PROFILE_CPU();
CallStaticMethod<void>(GetStaticMethodPointer(TEXT("Exit")));
Ready = false;
MDomains.ClearDelete();
MRootDomain = nullptr;
ShutdownHostfxr();