[PropertyCustomizationHelpers, SPropertyAssetPicker Cleanup] Scalar Deleting Destructor When Used In Plugin

Dear Epic,

I am trying to use PropertyCustomizationHelpers::MakeAssetPickerAnchorButton in an Editor Plugin that opens a tab in the Editor.

I used the plugin template code for making a tab.

I added only a few lines of code to the tab:

TSharedRef<SDockTab> FJoyGraphPluginModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
{
TSharedRef<SDockTab> NewTab = SNew(SDockTab)
		.TabRole(ETabRole::NomadTab)
		[
			SAssignNew(TabCanvas, SCanvas)
		];
	 
	//~~~
	    
	AssetPicker = PropertyCustomizationHelpers::MakeAssetPickerAnchorButton( 
				FOnGetAllowedClasses::CreateRaw( this, &FJoyGraphPluginModule::OnGetClassesForAssetPicker ),
				FOnAssetSelected::CreateRaw( this, &FJoyGraphPluginModule::OnAssetSelected )
			);
			
	//Add Data Asset Picker
	TabCanvas->AddSlot()
		.Position(FVector2D(50,50))
		.Size(FVector2D(20,20))//.Size(FVector2D(500,100))
		[   
			AssetPicker.ToSharedRef()		 
		];

return NewTab;
}

The code above creates a Canvas within the Tab, and then I add the Asset picker within this Canvas.

#The Issue

When I load the editor and the plugin module is activated via the toolbar button, the Tab opens and I can pick assets just fine.

However during editor shutdown, when the plugin module shuts down, I get the crash below regarding scalar deleting destructor, which seems to indicate that SPropertyAsset Picker is not getting cleaned up correctly.

I’ve added other widgets to the canvas above with no issues, and they delete fine, every time.

It is only the SPropertyAssetPicker created via PropertyCustomizationHelpers::MakeAssetPickerAnchorButton that is not getting deleted properly.

#Plugin Module Shutdown

void FJoyGraphPluginModule::ShutdownModule()
{
	// This function may be called during shutdown to clean up your module.  For modules that support dynamic reloading,
	// we call this function before unloading the module.
	FJoyGraphPluginStyle::Shutdown();

	FJoyGraphPluginCommands::Unregister();

	FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(JoyGraphPluginTabName);
	  
	TabCanvas.Reset();  //Crash here
} 

#Question

Is there any way I can manually delete the SPropertyAssetPicker to remove this crash when the module is unloaded?

#Content Browser Module

Please note that SPropertyAssetPicker is internally using the Content Browser module:

ContentBrowserModule.Get().CreateAssetPicker(AssetPickerConfig);

So do you think my crash could be because the UE4 API Helper is using the Content Browser, which my plugin is then using, and both the content browser module and my plugin module are trying to destroy the widget?

-Rama

#Crash

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

Assertion failed: (!ModuleInfo->bWasUnloadedAtShutdown) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\Core\Private\Modules\ModuleManager.cpp] [Line: 343] 
Attempted to load

UE4Editor_Core!FDebug::AssertFailed() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\misc\outputdevice.cpp:374]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\modules\modulemanager.cpp:343]
UE4Editor_Core!FModuleManager::LoadModule() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\modules\modulemanager.cpp:298]
UE4Editor_ContentBrowser!FModuleManager::LoadModuleChecked<FGameProjectGenerationModule>() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\modules\modulemanager.h:276]
UE4Editor_ContentBrowser!FGameProjectGenerationModule::Get() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\gameprojectgeneration\public\gameprojectgenerationmodule.h:54]
UE4Editor_ContentBrowser!FNativeClassHierarchy::GetGameModules() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\contentbrowser\private\nativeclasshierarchy.cpp:468]
UE4Editor_ContentBrowser!FNativeClassHierarchy::PopulateHierarchy() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\contentbrowser\private\nativeclasshierarchy.cpp:183]
UE4Editor_ContentBrowser!FNativeClassHierarchy::FNativeClassHierarchy() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\contentbrowser\private\nativeclasshierarchy.cpp:45]
UE4Editor_ContentBrowser!FContentBrowserSingleton::GetNativeClassHierarchy() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\contentbrowser\private\contentbrowsersingleton.cpp:346]
UE4Editor_ContentBrowser!SAssetView::~SAssetView() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\contentbrowser\private\sassetview.cpp:55]
UE4Editor_ContentBrowser!SAssetView::`scalar deleting destructor'()
UE4Editor_SlateCore!TIndirectArray<SBoxPanel::FSlot,FDefaultAllocator>::DestructAndFreeItems() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\containers\array.h:3331]
UE4Editor_SlateCore!TPanelChildren<SBoxPanel::FSlot>::~TPanelChildren<SBoxPanel::FSlot>()
UE4Editor_SlateCore!SVerticalBox::~SVerticalBox()
UE4Editor_ContentBrowser!SVerticalBox::`scalar deleting destructor'()
UE4Editor_SlateCore!FSimpleSlot::~FSimpleSlot()
UE4Editor_SlateCore!SCompoundWidget::~SCompoundWidget()
UE4Editor_ContentBrowser!SAssetPicker::`scalar deleting destructor'()
UE4Editor_SlateCore!FSimpleSlot::~FSimpleSlot()
UE4Editor_SlateCore!SCompoundWidget::~SCompoundWidget()
UE4Editor_PropertyEditor!SBorder::`scalar deleting destructor'()
UE4Editor_SlateCore!FSlotBase::~FSlotBase() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\slatecore\private\slotbase.cpp:45]
UE4Editor_Slate!SBox::~SBox()
UE4Editor_PropertyEditor!SBox::`scalar deleting destructor'()
UE4Editor_Slate!SMenuAnchor::~SMenuAnchor() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\slate\private\widgets\input\smenuanchor.cpp:496]
UE4Editor_PropertyEditor!SMenuAnchor::`scalar deleting destructor'()
UE4Editor_SlateCore!TIndirectArray<SBoxPanel::FSlot,FDefaultAllocator>::DestructAndFreeItems() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\containers\array.h:3331]
UE4Editor_SlateCore!TPanelChildren<SBoxPanel::FSlot>::~TPanelChildren<SBoxPanel::FSlot>()
UE4Editor_SlateCore!SVerticalBox::~SVerticalBox()
UE4Editor_PropertyEditor!SVerticalBox::`scalar deleting destructor'()
UE4Editor_SlateCore!FSimpleSlot::~FSimpleSlot()
UE4Editor_SlateCore!SCompoundWidget::~SCompoundWidget()
UE4Editor_PropertyEditor!SPropertyAssetPicker::`scalar deleting destructor'()
UE4Editor_JoyGraphPlugin!FJoyGraphPluginModule::~FJoyGraphPluginModule()
UE4Editor_JoyGraphPlugin!FJoyGraphPluginModule::`scalar deleting destructor'()
UE4Editor_Core!FModuleManager::UnloadModule() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\modules\modulemanager.cpp:505]
UE4Editor_Core!FModuleManager::UnloadModulesAtShutdown() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\modules\modulemanager.cpp:626]
UE4Editor!FEngineLoop::Exit() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launchengineloop.cpp:2228]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launch.cpp:153]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll

#Most Relevant

Most relevant part of the crash begins here, note that my module is being unloaded and the SPropertyAssetPicker is triggering the scalar deleting destructor error

 UE4Editor_SlateCore!SVerticalBox::~SVerticalBox()
 UE4Editor_PropertyEditor!SVerticalBox::`scalar deleting destructor'()
 UE4Editor_SlateCore!FSimpleSlot::~FSimpleSlot()
 UE4Editor_SlateCore!SCompoundWidget::~SCompoundWidget()
 UE4Editor_PropertyEditor!SPropertyAssetPicker::`scalar deleting destructor'()
 UE4Editor_JoyGraphPlugin!FJoyGraphPluginModule::~FJoyGraphPluginModule()
 UE4Editor_JoyGraphPlugin!FJoyGraphPluginModule::`scalar deleting destructor'()
 UE4Editor_Core!FModuleManager::UnloadModule() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\modules\modulemanager.cpp:505]
 UE4Editor_Core!FModuleManager::UnloadModulesAtShutdown() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\modules\modulemanager.cpp:626]

#Thank You

Thank you for reviewing this!

Rama

PS: once again, this crash only happens with SPropertyAssetPicker, I use the exact same code structure with other SCompoundWidgets, including my own, and everything works great.

Really? No answers to this? I’m having the same problem :frowning: