Skip to content

Commit 3838651

Browse files
authored
LP360: avoid double-removal of floating dock containers (#838)
In DockManagerPrivate::restoreStateFromXml() the floating widgets were removed via removeDockContainer() and then queued for deletion with deleteLater(). When ~CDockContainerWidget() ran it would call removeDockContainer() a second time on the same container, tripping the Q_ASSERT(removed == 1) check in CDockManager::removeDockContainer(). Switch to CDockContainerWidget::removeFromDockManager() (introduced in upstream 544c624) so the container's back-pointer to the manager is cleared up front and the destructor becomes a no-op for the manager side. This keeps the LP360_AI workspace restore path crash-free until the equivalent fix lands upstream.
1 parent 985ff74 commit 3838651

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/DockManager.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,12 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
349349
{
350350
CFloatingDockContainer* floatingWidget = FloatingWidgets[i];
351351
if (!floatingWidget) continue;
352-
_this->removeDockContainer(floatingWidget->dockContainer());
352+
// Use removeFromDockManager() (introduced in upstream commit 544c624) instead
353+
// of removeDockContainer() so the container's back-pointer to the manager is
354+
// cleared. Otherwise ~CDockContainerWidget() (called when deleteLater() fires)
355+
// would try to remove this container a second time, tripping the
356+
// Q_ASSERT(removed == 1) check in CDockManager::removeDockContainer().
357+
floatingWidget->dockContainer()->removeFromDockManager();
353358
floatingWidget->deleteLater();
354359
}
355360
}

0 commit comments

Comments
 (0)