Editor crash on startup

Hi,

I am getting a crash on startup to do with binding commands for showing / hiding volume types

The crash is in SLevelViewport.cpp BindShowCommands:

		for( int32 VolumeClassIndex = 0; VolumeClassIndex < VolumeClasses.Num(); ++VolumeClassIndex )
		{
			CommandList.MapAction(
				FLevelViewportCommands::Get().ShowVolumeCommands[ VolumeClassIndex ].ShowMenuItem,
				FExecuteAction::CreateSP( this, &SLevelViewport::ToggleShowVolumeClass, VolumeClassIndex ),
				FCanExecuteAction(),
				FIsActionChecked::CreateSP( this, &SLevelViewport::IsVolumeVisible, VolumeClassIndex ) );
		}

With an index out of bounds accessing ShowVolumeCommands. The VolumeClasses array is larger than the ShowVolumeCommands array.

The reason for this is in the LevelEditorModule::RegisterCommands function. This is only ever called once when the module is started, but if a plugin creates a new type of AVolume and is loaded after this module’s StartupModule is called, then calling UUnrealEdEngine::GetSortedVolumeClasses(&VolumeClasses); will return different results.

Currently, I see the FPaperLevelEditorMenuExtensions::InstallHooks() calling FModuleManager::Get().LoadModuleChecked(“LevelEditor”);

This is before the plugin (in this case Simplygon) that contains a new volume type is loaded. Is there some way to fix the loading order as a workaround?

Thanks,
Ben

Hi Ben,

Thanks for the bug report. Which volume type is it that Simplygon is loading after the ShowVolumeCommands have been populated?

This system needs reworking, but it should be possible to work around it for the moment. If you can give me some repro steps, I’ll attempt to reproduce it myself and add a defect report for it.

Many thanks,
Rich

Simplygon loads a new class called AReplacementVolume. It is Paper2D that is loaded before Simplygon that is causing the LevelEditorModule to load first.

For now, my workaround is to force the loading phase of Simplygon to PreDefault. Not an ideal solution of course, but it works with no apparent side effects.

For some reason, after integrating Simplygon, I didn’t get this crash. It seemed to occur after I closed the editor and reopened it, so it may have something to do with persisting some settings too.

Thanks,
Ben

That sounds like the sort of workaround I was going to suggest for now, I’m glad you’re no longer blocked by this.

This issue has been entered as UE-35493 - it’s going to require a fair bit of refactoring, but it clearly needs addressing. When we have a proper fix for this, we’ll let you know here.

All the best,

Rich