CesiumGS / cesium-unreal

Bringing the 3D geospatial ecosystem to Unreal Engine
https://cesium.com/platform/cesium-for-unreal/
Apache License 2.0
902 stars 287 forks source link

Crash on exit #1363

Closed kring closed 3 months ago

kring commented 5 months ago

I frequently see a crash on exit. This is the call stack:

>   [Inline Frame] UnrealEditor-CesiumEditor.dll!FCesiumGeoreferenceCustomization::Unregister(FPropertyEditorModule &) Line 20  C++
    [Inline Frame] UnrealEditor-CesiumEditor.dll!?A0x82102606::unregisterDetailCustomization() Line 130 C++
    UnrealEditor-CesiumEditor.dll!FCesiumEditorModule::ShutdownModule() Line 391    C++
    [Inline Frame] UnrealEditor-Core.dll!FModuleManager::UnloadModule(const FName) Line 686 C++
    UnrealEditor-Core.dll!FModuleManager::UnloadModulesAtShutdown() Line 816    C++
    UnrealEditor.exe!FEngineLoop::Exit() Line 4650  C++
    [Inline Frame] UnrealEditor.exe!EngineExit() Line 77    C++
    [Inline Frame] UnrealEditor.exe!GuardedMain::__l2::EngineLoopCleanupGuard::{dtor}() Line 131    C++
    UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 216  C++
    UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 233  C++
    UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 282    C++
    [Inline Frame] UnrealEditor.exe!invoke_main() Line 102  C++
    UnrealEditor.exe!__scrt_common_main_seh() Line 288  C++
    kernel32.dll!00007ffc17c2257d() Unknown
    ntdll.dll!00007ffc1900aa58()    Unknown

It's an access violation that looks like this:

Exception thrown: read access violation.
**__imp_ACesiumGeoreference::GetPrivateStaticClass**(...) returned 0x21364955F50.
image

So we're unloading the CesiumEditor module, and apparently ACesiumGeoreference::StaticClass() is returning an invalid pointer. Based on the Unreal log, it doesn't look like the CesiumRuntime module was unloaded first, so I don't really know why that pointer would be invalid.

kring commented 5 months ago

I've seen this in multiple branches, so I'm fairly certain whatever caused it is already in main.

csciguy8 commented 3 months ago

I see this when running out of this new branch to support UE 5.4, and running in UE 5.4

Running attached to MSVS, DebugGame build. Just opening cesium-unreal-samples, level 01, then closing after a few moments.