Prevent crashing on screen deletion.

Even child windows need to hook into the screen destroyed signal to
avoid having a dangling screen pointer.

Change-Id: I7b613356c333be6e9dfdf5db45f70a521a9b8fe2
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
bb10
Samuel Rødal 2012-10-01 10:10:08 +02:00 committed by The Qt Project
parent a0c3a57aed
commit 9577c22781
1 changed files with 2 additions and 0 deletions

View File

@ -177,6 +177,7 @@ QWindow::QWindow(QWindow *parent)
d->screen = parent->screen();
if (!d->screen)
d->screen = QGuiApplication::primaryScreen();
connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*)));
QGuiApplicationPrivate::window_list.prepend(this);
}
@ -202,6 +203,7 @@ QWindow::QWindow(QWindowPrivate &dd, QWindow *parent)
d->screen = parent->screen();
if (!d->screen)
d->screen = QGuiApplication::primaryScreen();
connect(d->screen, SIGNAL(destroyed(QObject*)), this, SLOT(screenDestroyed(QObject*)));
QGuiApplicationPrivate::window_list.prepend(this);
}