summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-11-16 20:38:39 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-11-28 10:11:08 +0000
commit9e1cb252e0c2628c238150250670a55bd479846c (patch)
tree43c558485cc11d388565ac4f570c1b43126caa24
parentf4a84ac966077ec9e27c99a43b6911ebab1331bb (diff)
Destroy QWindowContainer's fake parent window when not needed
Keeping the fake parent window around in a created state means we're wasting system resources such as native platform views/windows, and makes it harder to debug the lifetime of these resources. The fake window will be re-created if re-parented into at a later point. Change-Id: Ib82560e7e565af19d58afe121fd087669a6ffb95 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index 4ef34f0102..4b289d2d33 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -315,6 +315,7 @@ bool QWindowContainer::event(QEvent *e)
d->window->setParent(d->usesNativeWidgets
? windowHandle()
: window()->windowHandle());
+ d->fakeParent.destroy();
}
if (d->window->parent()) {
d->markParentChain();
@@ -404,6 +405,7 @@ void QWindowContainer::parentWasChanged(QWidget *parent)
Q_ASSERT(toplevel->windowHandle());
}
d->window->setParent(toplevel->windowHandle());
+ d->fakeParent.destroy();
d->updateGeometry();
}
}