Fix crash due to MainWindow not clearing m_overlayedDockWidget

When we close the overlayed widget we need to clear this variable

Added 1 real fix and a prophylactic check too.
This commit is contained in:
Sergio Martins
2021-04-27 23:49:26 +01:00
parent 74c74593e2
commit c4d3ba71b2
3 changed files with 41 additions and 2 deletions

View File

@@ -603,8 +603,18 @@ void DockWidgetBase::Private::close()
return;
}
if (!m_isForceClosing && q->isFloating() && q->isVisible()) { // only user-closing is interesting to save the geometry
// We check for isVisible so we don't save geometry if you call close() on an already closed dock widget
// If it's overlayed and we're closing, we need to close the overlay
if (SideBar *sb = DockRegistry::self()->sideBarForDockWidget(q)) {
auto mainWindow = sb->mainWindow();
if (mainWindow->overlayedDockWidget() == q) {
mainWindow->clearSideBarOverlay(/* deleteFrame=*/false);
}
}
if (!m_isForceClosing && q->isFloating()
&& q->isVisible()) { // only user-closing is interesting to save the geometry
// We check for isVisible so we don't save geometry if you call close() on an already closed
// dock widget
m_lastPositions.setLastFloatingGeometry(q->window()->geometry());
}