summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-02-06 16:58:15 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-06 16:48:22 +0100
commit16c4224568b7969591120f163dc81ba61cd1e6f8 (patch)
tree0b06333bd50689f545e061755fb8c97eaf9d72c0 /src/gui/kernel/qwindow.cpp
parent5d255789cdd6f1d301c161e25151595ca06db436 (diff)
Destroy the QWindow children in destroy() instead of close()
When closing a window, destroy() ensures a setVisible(false) call only for the window itself, not for other windows parented to it. With the new quit lock ref feature this breaks code that creates a fake root window parented to the main, visible window. (for example the xcomposite backends of qtwayland do this) Such apps do not anymore exit after closing their window because the children do not receive a deref due to setVisible not getting called. (At that point. It would get called after exiting the event loop but that never happens due to the refcounting) Change-Id: I124737c80ad59600ddc79261100f3904af0f410d Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 4436884359..b451a6ee33 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -731,6 +731,15 @@ void QWindow::setWindowIcon(const QImage &icon) const
void QWindow::destroy()
{
Q_D(QWindow);
+ QObjectList childrenWindows = children();
+ for (int i = 0; i < childrenWindows.size(); i++) {
+ QObject *object = childrenWindows.at(i);
+ if (object->isWindowType()) {
+ QWindow *w = static_cast<QWindow*>(object);
+ QGuiApplicationPrivate::window_list.removeAll(w);
+ w->destroy();
+ }
+ }
setVisible(false);
delete d->platformWindow;
d->platformWindow = 0;
@@ -881,16 +890,6 @@ bool QWindow::close()
if (QGuiApplicationPrivate::focus_window == this)
QGuiApplicationPrivate::focus_window = 0;
- QObjectList childrenWindows = children();
- for (int i = 0; i < childrenWindows.size(); i++) {
- QObject *object = childrenWindows.at(i);
- if (object->isWindowType()) {
- QWindow *w = static_cast<QWindow*>(object);
- QGuiApplicationPrivate::window_list.removeAll(w);
- w->destroy();
- }
- }
-
QGuiApplicationPrivate::window_list.removeAll(this);
destroy();
d->maybeQuitOnLastWindowClosed();