forked from qt-creator/qt-creator
Debugger: Properly clean up dock widgets
We call setParent(0) on the dock widgets, not on the actual operation widgets. In order to find out which ones we need to delete we need to check both the operations and the dock widgets. Change-Id: Ia6fde9bc1737aab6b6ad5497b27e805bcd67d0ab Task-number: QTCREATORBUG-16074 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -81,12 +81,16 @@ DebuggerMainWindow::~DebuggerMainWindow()
|
||||
{
|
||||
// As we have to setParent(0) on dock widget that are not selected,
|
||||
// we keep track of all and make sure we don't leak any
|
||||
foreach (QDockWidget *dock, m_dockForDockId) {
|
||||
if (dock && !dock->parentWidget())
|
||||
delete dock;
|
||||
}
|
||||
|
||||
foreach (const Perspective &perspective, m_perspectiveForPerspectiveId) {
|
||||
foreach (const Perspective::Operation &operation, perspective.operations()) {
|
||||
if (operation.widget && !operation.widget->parentWidget()) {
|
||||
// These are from inactive perspectives. We call setParent(0) when deactivating
|
||||
// a perspective so that the widgets can't be accidentally enabled in the wrong
|
||||
// perspectives. That's why we have to delete them manually here.
|
||||
// These are from perspectives that never got enabled. We've taken ownership for
|
||||
// those, so we need to delete them.
|
||||
delete operation.widget;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user