QDockWidget: Fix memory leak when dragging a tab outside of a floating tab window
A QDockWidgetItem will be leaked if a QDockWidget is dragged out of a floating tab window, and then plugged back somewhere. The problem is that QMainWindowLayout::unplug was not returning the QDockWidgetItem* from the floating tab's layout. When that's the case, a new QDockWidgetItem is created in QDockWidgetPrivate::startDrag and will be put into the layout, leaking the old QDockWidgetItem. Change-Id: Ifb9c1c562cb74383ebff1df0f91ee225c5cdb296 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
This commit is contained in:
parent
c4f122927a
commit
4d3781b640
@ -2378,7 +2378,8 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group)
|
||||
// We are unplugging a dock widget from a floating window.
|
||||
if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) {
|
||||
dw->d_func()->unplug(widget->geometry());
|
||||
return 0;
|
||||
int index = widget->parentWidget()->layout()->indexOf(widget);
|
||||
return widget->parentWidget()->layout()->itemAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user