From 5d6831d1795d69cd611c3465ad3ec957bfff37fe Mon Sep 17 00:00:00 2001 From: tmartsum Date: Fri, 1 Dec 2023 15:13:45 +0100 Subject: [PATCH] Fix DockWidget crach when area is a nullptr. (#582) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When requesting hide on a dockwidget that has been added to a dockmanager, but isn't yet visible, there was a creash. The crash has been fixed by moving the code to the existing guard check for the area. Co-authored-by: Thorbjørn Lund Martsum --- src/DockWidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 8e2ba7e..2d4cfe2 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -749,11 +749,10 @@ void CDockWidget::toggleViewInternal(bool Open) if (d->DockArea) { d->DockArea->toggleDockWidgetView(this, Open); - } - - if (d->DockArea->isAutoHide()) - { - d->DockArea->autoHideDockContainer()->toggleView(Open); + if (d->DockArea->isAutoHide()) + { + d->DockArea->autoHideDockContainer()->toggleView(Open); + } } if (Open && TopLevelDockWidgetBefore)