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 Change-Id: I1c065b5158d32150042d25fb64f10cf48f83f9f4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 1062373b8e2f8ecf63b7a60a34ca9d0b83466de3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ebccd49dbb
commit
60c33a2501
@ -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…
x
Reference in New Issue
Block a user