Avoid dock manager double delete (crashes) (#587)

If a dockwidget has been manually deleted, the dockmanager
would delete it again when deleting the area in its dtor.
The 'optimal' solution would likely have been changing
CDockWidget::~CDockWidget to add
if (d->DockArea) d->DockArea->removeDockWidget(this);
(before delete d).
However, it is not trivial (for me) to conclude that such
a change would be safe on program shutdown.

Co-authored-by: Thorbjørn Lund Martsum <thorbjorn@luxion.com>
This commit is contained in:
tmartsum 2023-12-06 15:12:48 +01:00 committed by GitHub
parent a7a97e6978
commit c34d479d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ class CDockAreaLayout
{ {
private: private:
QBoxLayout* m_ParentLayout; QBoxLayout* m_ParentLayout;
QList<QWidget*> m_Widgets; QList<QPointer<QWidget>> m_Widgets;
int m_CurrentIndex = -1; int m_CurrentIndex = -1;
QWidget* m_CurrentWidget = nullptr; QWidget* m_CurrentWidget = nullptr;