QMainWindowLayout: Fix leaking of unused tab bars
QMainWindowLayout::unusedTabBars contains unparented tab bars. They are leaked when QMainWindow and its layout get destroyed. They still are in QApplication::allWidgets(), which attempts to delete them eventually. When that happens, they try to remove themselves from an already deleted QMainWindowLayout::unusedTabBars. Delete all unused tab bars in the d'tor of QMainWindowLayout. Task-number: QTBUG-135468 Pick-to: 6.9 6.8 6.5 Change-Id: I5ac7748ef738955522567db585e9505e3ba435ad Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
1bbbacbecb
commit
23357e59bb
@ -2726,6 +2726,11 @@ QMainWindowLayout::~QMainWindowLayout()
|
||||
layoutState.deleteCentralWidgetItem();
|
||||
|
||||
delete statusbar;
|
||||
|
||||
// unusedTabBars contains unparented tab bars, which need to be removed manually.
|
||||
// ~QMainWindowTabBar() removes the bar from unusedTabBars => call qDeleteAll() on a copy.
|
||||
const auto bars = unusedTabBars;
|
||||
qDeleteAll(bars);
|
||||
}
|
||||
|
||||
void QMainWindowLayout::setDockOptions(QMainWindow::DockOptions opts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user