From 2fbb2a73c6a3faad4ede23b5ce8016e5093f5624 Mon Sep 17 00:00:00 2001 From: Benjamin Jillich <43751992+amzn-jillich@users.noreply.github.com> Date: Tue, 23 Nov 2021 08:55:53 +0100 Subject: [PATCH] Animation Editor: Morph targets window shows duplicated morph targets (#5831) Dialog stack wasn't deleting the morph target widgets after reinitializing the window which ended up in duplicated morph targets Signed-off-by: Benjamin Jillich --- .../EMotionFX/Code/MysticQt/Source/DialogStack.cpp | 14 +++++++++----- Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h | 12 ++---------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp index 5e9cf66fa7..30d54c6b7b 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp +++ b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp @@ -71,8 +71,6 @@ namespace MysticQt setWidget(m_rootSplitter); } - - // destructor DialogStack::~DialogStack() { } @@ -81,6 +79,14 @@ namespace MysticQt // get rid of all dialogs and their allocated memory void DialogStack::Clear() { + for (Dialog& dialog : m_dialogs) + { + if (dialog.m_dialogWidget) + { + dialog.m_dialogWidget->deleteLater(); + } + } + // destroy the dialogs m_dialogs.clear(); @@ -679,6 +685,4 @@ namespace MysticQt return; } } -} // namespace MysticQt - -#include +} // namespace MysticQt diff --git a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h index bf93b5d23f..64a48fb392 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h +++ b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h @@ -6,10 +6,8 @@ * */ -#ifndef __MYSTICQT_DIALOGSTACK_H -#define __MYSTICQT_DIALOGSTACK_H +#pragma once -// #if !defined(Q_MOC_RUN) #include "MysticQtConfig.h" #include @@ -30,14 +28,10 @@ namespace MysticQt { class DialogStackSplitter; - /** - * - * - */ class MYSTICQT_API DialogStack : public QScrollArea { - Q_OBJECT + Q_OBJECT // AUTOMOC public: DialogStack(QWidget* parent = nullptr); @@ -89,5 +83,3 @@ namespace MysticQt int32 m_prevMouseY; }; } // namespace MysticQt - -#endif