From 0b3e3af90c857158231cc5cc64325c44cdf933cd Mon Sep 17 00:00:00 2001 From: Frank Darmayan Date: Wed, 20 May 2026 14:18:56 -0500 Subject: [PATCH] LP360: avoid double-removal of floating dock containers 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. --- src/DockManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/DockManager.cpp b/src/DockManager.cpp index a7c639e5..b99cb338 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -349,7 +349,12 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi { CFloatingDockContainer* floatingWidget = FloatingWidgets[i]; if (!floatingWidget) continue; - _this->removeDockContainer(floatingWidget->dockContainer()); + // Use removeFromDockManager() (introduced in upstream commit 544c624) instead + // of removeDockContainer() so the container's back-pointer to the manager is + // cleared. Otherwise ~CDockContainerWidget() (called when deleteLater() fires) + // would try to remove this container a second time, tripping the + // Q_ASSERT(removed == 1) check in CDockManager::removeDockContainer(). + floatingWidget->dockContainer()->removeFromDockManager(); floatingWidget->deleteLater(); } }