QNX: fix bug on window hierarchy list
authorRafael Roquetto <rafael.roquetto.qnx@kdab.com>
Thu, 27 Sep 2012 22:10:37 +0000 (19:10 -0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 28 Sep 2012 21:50:10 +0000 (23:50 +0200)
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>
src/plugins/platforms/qnx/qqnxwindow.cpp

index a3abac9..42bc5b6 100644 (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);
     }