I have been testing editor runs with FMallocStomp2 for a couple days looking for some memory trampling issues. Yesterday I hit a shutdown crash that looks like it throws into question a commonly used pattern in module code. With mallocstomp allocators, memory gets trampled as soon as it is freed, so use-after-free bugs get thrown into high contrast.
The crash was in this “experimental” code. The specific bit was GetFName() being invoked on a bad pointer. The static class had already been destroyed by the engine shutdown. Surveying other uses of UnregisterCustomClassLayout() shows about half of the cases cache the FName from earlier and re-use it, but that leaves about half doing this StaticClass()->GetFName() call pattern.
If that’s an unsafe pattern, it should be scrubbed from the codebase. If it’s intended to be a safe pattern and isn’t, you should take a look at the order of operations between the static class registration and module manager shutdown.
[Content removed]
void FHairCardGeneratorEditorModule::ShutdownModule()
{
HairCardGenerator_Utils::UnregisterModularHairCardGenerator(this);
// Register custom detail panel handler for hair card settings
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
PropertyModule.UnregisterCustomClassLayout(UHairCardGeneratorPluginSettings::StaticClass()->GetFName());
}