CesiumGS / cesium-unreal

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

Fix intermittent shutdown crash (static class GC'd) #1402

Closed csciguy8 closed 4 months ago

csciguy8 commented 4 months ago

Fixes #1363 .

For all of our classes deriving from IDetailCustomization, change the call to ::UnregisterCustomClassLayout to use a saved version of the class name that we called ::RegisterCustomClassLayout with.

We don't want to access that class with ::StaticClass() during shutdown, it's already been sent to the garbage collector to be destroyed. Sometimes the GC wouldn't have gotten to it yet (and you don't crash). But other times the static class data is garbage and we'll get an access violation.

I could reproduce this 100% of the time in UE 5.4 in DebugGame, with the following UI layout... image

j9liu commented 4 months ago

Looks good to me, thanks @csciguy8 !