diff --git a/src/libs/advanceddockingsystem/dockmanager.cpp b/src/libs/advanceddockingsystem/dockmanager.cpp index 4615df6bfeb..dd67af205a2 100644 --- a/src/libs/advanceddockingsystem/dockmanager.cpp +++ b/src/libs/advanceddockingsystem/dockmanager.cpp @@ -92,7 +92,7 @@ namespace ADS { public: DockManager *q; - QList m_floatingWidgets; + QList> m_floatingWidgets; QList m_containers; DockOverlay *m_containerOverlay = nullptr; DockOverlay *m_dockAreaOverlay = nullptr; @@ -357,9 +357,11 @@ namespace ADS save(); saveStartupWorkspace(); - for (auto floatingWidget : d->m_floatingWidgets) - delete floatingWidget; - + for (auto floatingWidget : d->m_floatingWidgets) { + if (floatingWidget) + delete floatingWidget.data(); + } + d->m_floatingWidgets.clear(); delete d; } @@ -485,7 +487,7 @@ namespace ADS return d->m_containers; } - const QList DockManager::floatingWidgets() const + const QList> DockManager::floatingWidgets() const { return d->m_floatingWidgets; } diff --git a/src/libs/advanceddockingsystem/dockmanager.h b/src/libs/advanceddockingsystem/dockmanager.h index 43ba751e48b..174239e22a7 100644 --- a/src/libs/advanceddockingsystem/dockmanager.h +++ b/src/libs/advanceddockingsystem/dockmanager.h @@ -389,7 +389,7 @@ public: /** * Returns the list of all floating widgets. */ - const QList floatingWidgets() const; + const QList > floatingWidgets() const; /** * This function always return 0 because the main window is always behind