Delete the reference of the QNX screen in child windows on deletion

Change-Id: Ic3e5deaeabe282ff44400aba80f8746067473030
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Fabian Bumberger 2013-03-05 17:58:24 +01:00 committed by The Qt Project
parent f2162d04d2
commit 15768381ad
2 changed files with 10 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);
}
}