You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fixed a crash on shutdown related to Editor Mode changes.
#rnx #Jira UE-93562 #rb lauren.barnes rex.hill #ROBOMERGE-OWNER: ryan.gerleve #ROBOMERGE-AUTHOR: brooke.hubert #ROBOMERGE-SOURCE: CL 13647851 via CL 13647853 via CL 13647859 via CL 13647868 #ROBOMERGE-BOT: NETWORKING (Main -> Dev-Networking) (v707-13641620) [CL 13648305 by brooke hubert in Dev-Networking branch]
This commit is contained in:
@@ -76,17 +76,26 @@ FEditorModeTools::FEditorModeTools()
|
||||
{
|
||||
// Register our callback for undo/redo
|
||||
GEditor->RegisterForUndo(this);
|
||||
|
||||
// This binding ensures the mode is destroyed if the type is unregistered outside of normal shutdown process
|
||||
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OnEditorModeUnregistered().AddRaw(this, &FEditorModeTools::OnModeUnregistered);
|
||||
}
|
||||
}
|
||||
|
||||
FEditorModeTools::~FEditorModeTools()
|
||||
{
|
||||
// Should we call Exit on any modes that are still active, or is it too late?
|
||||
if (GEditor)
|
||||
{
|
||||
GEditor->UnregisterForUndo(this);
|
||||
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OnEditorModeUnregistered().RemoveAll(this);
|
||||
}
|
||||
|
||||
DeactivateAllModes();
|
||||
RecycledScriptableModes.Empty();
|
||||
|
||||
USelection::SelectionChangedEvent.RemoveAll(this);
|
||||
USelection::SelectNoneEvent.RemoveAll(this);
|
||||
USelection::SelectObjectEvent.RemoveAll(this);
|
||||
|
||||
GEditor->UnregisterForUndo(this);
|
||||
}
|
||||
|
||||
void FEditorModeTools::LoadConfig(void)
|
||||
@@ -579,6 +588,11 @@ void FEditorModeTools::DeactivateScriptableModeAtIndex(int32 InIndex)
|
||||
ActiveScriptableModes.RemoveAt(InIndex);
|
||||
}
|
||||
|
||||
void FEditorModeTools::OnModeUnregistered(FEditorModeID ModeID)
|
||||
{
|
||||
DestroyMode(ModeID);
|
||||
}
|
||||
|
||||
void FEditorModeTools::RebuildModeToolBar()
|
||||
{
|
||||
// If the tab or box is not valid the toolbar has not been opened or has been closed by the user
|
||||
|
||||
@@ -146,9 +146,6 @@ TSharedPtr<FEdMode> FEditorModeRegistry::CreateMode(FEditorModeID ModeID, FEdito
|
||||
Instance->Info = (*ModeFactory)->GetModeInfo();
|
||||
Instance->Owner = &Owner;
|
||||
|
||||
// This binding ensures the mode is destroyed if the type is unregistered
|
||||
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OnEditorModeUnregistered().AddSP(Instance, &FEdMode::OnModeUnregistered);
|
||||
|
||||
Instance->Initialize();
|
||||
|
||||
return Instance;
|
||||
|
||||
@@ -106,6 +106,9 @@ public:
|
||||
protected:
|
||||
/** Deactivates the editor mode at the specified index */
|
||||
void DeactivateScriptableModeAtIndex(int32 InIndex);
|
||||
|
||||
/** Removes the mode ID from the tools manager when a mode is unregistered */
|
||||
void OnModeUnregistered(FEditorModeID ModeID);
|
||||
|
||||
private:
|
||||
void RebuildModeToolBar();
|
||||
|
||||
Reference in New Issue
Block a user