Skip to content

Commit

Permalink
Traktor: Ensure "m_site" is null after editor page being destroyed.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed May 10, 2024
1 parent ee84d77 commit 447a0ab
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 15 deletions.
8 changes: 6 additions & 2 deletions code/Animation/Editor/AnimationGraphEditorPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,16 @@ bool AnimationGraphEditorPage::create(ui::Container* parent)

void AnimationGraphEditorPage::destroy()
{
m_site->destroyAdditionalPanel(m_propertiesView);
m_site->destroyAdditionalPanel(m_containerPreview);
if (m_propertiesView)
m_site->destroyAdditionalPanel(m_propertiesView);
if (m_containerPreview)
m_site->destroyAdditionalPanel(m_containerPreview);

safeDestroy(m_propertiesView);
safeDestroy(m_containerPreview);
safeDestroy(m_editorGraph);

m_site = nullptr;
}

bool AnimationGraphEditorPage::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
8 changes: 6 additions & 2 deletions code/Input/Editor/InputMappingEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,15 @@ bool InputMappingEditor::create(ui::Container* parent)

void InputMappingEditor::destroy()
{
m_site->destroyAdditionalPanel(m_propertiesView);
m_site->destroyAdditionalPanel(m_listValueSources);
if (m_propertiesView)
m_site->destroyAdditionalPanel(m_propertiesView);
if (m_listValueSources)
m_site->destroyAdditionalPanel(m_listValueSources);

safeDestroy(m_propertiesView);
safeDestroy(m_listValueSources);

m_site = nullptr;
}

bool InputMappingEditor::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
5 changes: 4 additions & 1 deletion code/Render/Editor/Image2/ImageGraphEditorPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,13 @@ bool ImageGraphEditorPage::create(ui::Container* parent)

void ImageGraphEditorPage::destroy()
{
m_site->destroyAdditionalPanel(m_propertiesView);
if (m_propertiesView)
m_site->destroyAdditionalPanel(m_propertiesView);

safeDestroy(m_propertiesView);
safeDestroy(m_editorGraph);

m_site = nullptr;
}

bool ImageGraphEditorPage::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
8 changes: 6 additions & 2 deletions code/Render/Editor/Shader/ShaderGraphEditorPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,10 @@ void ShaderGraphEditorPage::destroy()
m_site->destroyAdditionalPanel(m_shaderViewer);
}

m_site->destroyAdditionalPanel(m_dataContainer);
m_site->destroyAdditionalPanel(m_propertiesView);
if (m_dataContainer)
m_site->destroyAdditionalPanel(m_dataContainer);
if (m_propertiesView)
m_site->destroyAdditionalPanel(m_propertiesView);

m_nodeFacades.clear();
safeDestroy(m_editorGraph);
Expand All @@ -512,6 +514,8 @@ void ShaderGraphEditorPage::destroy()
safeDestroy(m_dataContainer);
safeDestroy(m_propertiesView);
safeDestroy(m_menuQuick);

m_site = nullptr;
}

bool ShaderGraphEditorPage::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
1 change: 1 addition & 0 deletions code/Render/Editor/Texture/TextureAssetEditorPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void TextureAssetEditorPage::destroy()
safeDestroy(m_propertiesView);

m_asset = nullptr;
m_site = nullptr;
}

bool TextureAssetEditorPage::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
10 changes: 7 additions & 3 deletions code/Scene/Editor/SceneEditorPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,12 @@ void SceneEditorPage::destroy()
m_context->getControllerEditor()->destroy();

// Destroy panels.
m_site->destroyAdditionalPanel(m_entityPanel);
m_site->destroyAdditionalPanel(m_tabMisc);
m_site->destroyAdditionalPanel(m_controllerPanel);
if (m_entityPanel)
m_site->destroyAdditionalPanel(m_entityPanel);
if (m_tabMisc)
m_site->destroyAdditionalPanel(m_tabMisc);
if (m_controllerPanel)
m_site->destroyAdditionalPanel(m_controllerPanel);

// Destroy widgets.
safeDestroy(m_editPanel);
Expand All @@ -542,6 +545,7 @@ void SceneEditorPage::destroy()
m_context->getPhysicsManager()->destroy();

safeDestroy(m_context);
m_site = nullptr;
}

bool SceneEditorPage::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
7 changes: 5 additions & 2 deletions code/Script/Editor/ScriptEditorPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ bool ScriptEditorPage::create(ui::Container* parent)

void ScriptEditorPage::destroy()
{
if (m_scriptDebuggerSessions != nullptr)
if (m_scriptDebuggerSessions)
{
m_scriptDebuggerSessions->removeListener(this);
m_scriptDebuggerSessions = nullptr;
Expand All @@ -279,8 +279,11 @@ void ScriptEditorPage::destroy()
m_scriptCompiler = nullptr;

// Destroy panels.
m_site->destroyAdditionalPanel(m_containerExplorer);
if (m_containerExplorer)
m_site->destroyAdditionalPanel(m_containerExplorer);

safeDestroy(m_containerExplorer);
m_site = nullptr;
}

bool ScriptEditorPage::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
5 changes: 4 additions & 1 deletion code/Sound/Editor/Processor/GraphEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,13 @@ void GraphEditor::destroy()

m_soundPlayer = nullptr;

m_site->destroyAdditionalPanel(m_propertiesView);
if (m_propertiesView)
m_site->destroyAdditionalPanel(m_propertiesView);

safeDestroy(m_propertiesView);
safeDestroy(m_resourceManager);

m_site = nullptr;
}

bool GraphEditor::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down
8 changes: 6 additions & 2 deletions code/Spray/Editor/EffectEditorPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,18 @@ void EffectEditorPage::destroy()
m_audioSystem = nullptr;

// Destroy panels.
m_site->destroyAdditionalPanel(m_containerSequencer);
m_site->destroyAdditionalPanel(m_propertiesView);
if (m_containerSequencer)
m_site->destroyAdditionalPanel(m_containerSequencer);
if (m_propertiesView)
m_site->destroyAdditionalPanel(m_propertiesView);

// Destroy widgets.
safeDestroy(m_propertiesView);
safeDestroy(m_containerSequencer);
safeDestroy(m_previewControl);
safeDestroy(m_resourceManager);

m_site = nullptr;
}

bool EffectEditorPage::dropInstance(db::Instance* instance, const ui::Point& position)
Expand Down

0 comments on commit 447a0ab

Please sign in to comment.