Android: Remove parent before adding window to screen
When a window's parent is set to null, remove the corresponding native view from its previous parent layout before adding it to the layout for top level windows. If the removal from the previous layout is done after adding the window to the screen, an exception will be thrown due to the view already having a parent. Fixes: QTBUG-121232 Pick-to: 6.7 Change-Id: I1c065b5158d32150042d25fb64f10cf48f83f9f4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>bb10
parent
ef01f32388
commit
1062373b8e
|
|
@ -182,9 +182,9 @@ void QAndroidPlatformWindow::setParent(const QPlatformWindow *window)
|
|||
m_nativeQtWindow.callMethod<void, QtWindow>("setParent", parentWindow.object());
|
||||
m_nativeParentQtWindow = parentWindow;
|
||||
} else if (QtAndroid::isQtApplication()) {
|
||||
platformScreen()->addWindow(this);
|
||||
m_nativeQtWindow.callMethod<void, QtWindow>("setParent", nullptr);
|
||||
m_nativeParentQtWindow = QJniObject();
|
||||
platformScreen()->addWindow(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue