diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index fc8b3bb167..dfd7ccf0cc 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -151,6 +151,8 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, QQnxScreen::~QQnxScreen() { qScreenDebug() << Q_FUNC_INFO; + Q_FOREACH (QQnxWindow *childWindow, m_childWindows) + childWindow->setScreen(0); delete m_cursor; } diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 43e24034c9..cabbd405e5 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -156,7 +156,8 @@ QQnxWindow::~QQnxWindow() // Remove from parent's Hierarchy. removeFromParent(); - m_screen->updateHierarchy(); + if (m_screen) + m_screen->updateHierarchy(); // Cleanup QNX window and its buffers screen_destroy_window(m_window); @@ -497,6 +498,11 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen; + if (platformScreen == 0) { // The screen has been destroyed + m_screen = 0; + return; + } + if (m_screen == platformScreen) return; @@ -539,7 +545,7 @@ void QQnxWindow::removeFromParent() m_parentWindow = 0; else qFatal("QQnxWindow: Window Hierarchy broken; window has parent, but parent hasn't got child."); - } else { + } else if (m_screen) { m_screen->removeWindow(this); } }