Crash on removing static component where parent not static on startup

Hi,

Recently I ran into an issue where I can’t load up some maps on 4.7 that previously loaded fine. I’m using latest GitHub build for 4.7.5 but last official 4.7.4 had the same issue. One map loads fine, but a couple of other maps crash on startup whether I try to open them from the editor or set the editor default map to be one of the ones with issues.

MachineId:D47B853049B93D1BF2971CB4BB59413F

Unknown exception - code 00000001 (first/second chance not available)

Assertion failed: !bRegistered || AttachParent->AttachChildren.Contains(this) [File:C:\Users\user\Documents\GitHub\UnrealEngine\Engine\Source\Runtime\Engine\Private\SceneComponent.cpp] [Line: 1093] 
Attempt to detach SceneComponent 'DefaultScene

KERNELBASE + 35740 bytes
UE4Editor_Core!FOutputDeviceWindowsError::Serialize() + 292 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:95]
UE4Editor_Core!FOutputDevice::Logf__VA() + 248 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\core\private\misc\outputdevice.cpp:144]
UE4Editor_Core!FDebug::AssertFailed() + 1079 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\core\private\misc\outputdevice.cpp:224]
UE4Editor_Engine!USceneComponent::DetachFromParent() + 364 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\scenecomponent.cpp:1093]
UE4Editor_Engine!AActor::DetachRootComponentFromParent() + 30 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\actor.cpp:1241]
UE4Editor_Engine!UWorld::DestroyActor() + 865 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\levelactor.cpp:493]
UE4Editor_Engine!UChildActorComponent::DestroyChildActor() + 451 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\childactorcomponent.cpp:286]
UE4Editor_Engine!UActorComponent::DestroyComponent() + 350 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\actorcomponent.cpp:849]
UE4Editor_Engine!AActor::DestroyConstructedComponents() + 608 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\actorconstruction.cpp:235]
UE4Editor_Engine!AActor::RerunConstructionScripts() + 3493 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\actorconstruction.cpp:424]
UE4Editor_Engine!ULevel::IncrementalUpdateComponents() + 521 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\level.cpp:745]
UE4Editor_Engine!UWorld::UpdateWorldComponents() + 820 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\engine\private\world.cpp:1215]
UE4Editor_UnrealEd!FUnrealEdMisc::CB_MapChange() + 173 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\unrealedmisc.cpp:930]
UE4Editor_UnrealEd!TBaseRawMethodDelegateInstance<0,FUnrealEdMisc,void __cdecl(unsigned int)>::ExecuteIfSafe() + 14 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:582]
UE4Editor_UnrealEd!TBaseMulticastDelegate<void,unsigned int>::Broadcast() + 165 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:1030]
UE4Editor_UnrealEd!UEditorEngine::Map_Load() + 7326 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\editorserver.cpp:2340]
UE4Editor_UnrealEd!UEditorEngine::HandleMapCommand() + 349 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\editorserver.cpp:5680]
UE4Editor_UnrealEd!UEditorEngine::Exec() + 797 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\editorserver.cpp:5180]
UE4Editor_UnrealEd!UUnrealEdEngine::Exec() + 273 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\unrealedsrv.cpp:742]
UE4Editor_UnrealEd!FEditorFileUtils::LoadMap() + 789 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\filehelpers.cpp:1910]
UE4Editor_UnrealEd!FEditorFileUtils::LoadDefaultMapAtStartup() + 216 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\filehelpers.cpp:3070]
UE4Editor_UnrealEd!FUnrealEdMisc::OnInit() + 2263 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\unrealedmisc.cpp:299]
UE4Editor_UnrealEd!EditorInit() + 3254 bytes [c:\users\user\documents\github\unrealengine\engine\source\editor\unrealed\private\unrealed.cpp:86]
UE4Editor!GuardedMain() + 925 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\launch\private\launch.cpp:133]
UE4Editor!GuardedMainWrapper() + 26 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() + 249 bytes [c:\users\user\documents\github\unrealengine\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

Turns out the problem was that I had an object added to multiple maps. In the latest map I had set the actor to static whereas previous maps hadn’t set it to static. In C++ there was some new code that set submeshes to static regardless of whether the parent was static or not. That caused the assert to fail on startup as it was loading and unloading meshes.