XCB: Solve crash when plugging a screen with unshown QWindow

If a QWindow has never been shown, it has no platformWindow (it's null).
So it's a valid condition and we need to be sure that the pointer isn't
null before dereferencing it.

Task-number: QTBUG-44766
Change-Id: Ia0aac2f09e9245339951ffff13c7eb024d6a0773
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Thiago Macieira 2015-03-02 23:03:22 -08:00
parent f4a8dceb67
commit 259b2b6cd7

View File

@ -399,6 +399,7 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan
// They need to be told the screen is back, it's OK to render.
foreach (QWindow *window, QGuiApplication::topLevelWindows()) {
QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle());
if (xcbWin)
xcbWin->maybeSetScreen(this);
}
}