QNX: fix bug on window hierarchy list

removeFromParent() must not be called from raise()/lower(), because it wrongly
sets m_currentParent to 0, causing the parent/child link to be broken after a
call either of these methods.

Change-Id: I58f847dc4a46f2cf120cb3acf230bac46bcf24f5
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
Rafael Roquetto 2012-09-27 19:10:37 -03:00 committed by The Qt Project
parent ac9be327f8
commit 4c33efc322

View File

@ -547,10 +547,9 @@ void QQnxWindow::raise()
{
qWindowDebug() << Q_FUNC_INFO << "window =" << window();
QQnxWindow *oldParent = m_parentWindow;
if (oldParent) {
removeFromParent();
oldParent->m_childWindows.push_back(this);
if (m_parentWindow) {
m_parentWindow->m_childWindows.removeAll(this);
m_parentWindow->m_childWindows.push_back(this);
} else {
m_screen->raiseWindow(this);
}
@ -562,10 +561,9 @@ void QQnxWindow::lower()
{
qWindowDebug() << Q_FUNC_INFO << "window =" << window();
QQnxWindow *oldParent = m_parentWindow;
if (oldParent) {
removeFromParent();
oldParent->m_childWindows.push_front(this);
if (m_parentWindow) {
m_parentWindow->m_childWindows.removeAll(this);
m_parentWindow->m_childWindows.push_front(this);
} else {
m_screen->lowerWindow(this);
}