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>
This commit is contained in:
parent
5d255789cd
commit
16c4224568
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user