QmlPuppet: Fix crash on active scene change

Active scene change involves deleting and recreating the View3D
instance of the 3D editor that imports the actual shown scene.
In Qt 5 it was necessary to mark the deleted View3D instance as having
no content, so it wouldn't receive any more updates. This hack no
longer appears to be necessary and causes this crash instead, so it
was removed.

Fixes: QDS-4786
Change-Id: I848ac78dc2f951ba7e1bf4d3d6aa4244b1443309
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2021-08-06 15:58:03 +03:00
parent fec3ef202f
commit 7211b7abf2
2 changed files with 3 additions and 12 deletions

View File

@@ -105,8 +105,6 @@ Item {
function updateActiveScene()
{
if (editView) {
// Destroy is async, so make sure we don't get any more updates for the old editView
_generalHelper.enableItemUpdate(editView, false);
editView.visible = false;
editView.destroy();
}
@@ -157,14 +155,6 @@ Item {
updateActiveScene();
}
// Disables edit view update if scene doesn't match current activeScene.
// If it matches, updates are enabled.
function enableEditViewUpdate(scene)
{
if (editView)
_generalHelper.enableItemUpdate(editView, (scene && scene === activeScene));
}
function handleActiveSceneIdChange(newId)
{
if (sceneId !== newId) {

View File

@@ -642,12 +642,13 @@ void Qt5InformationNodeInstanceServer::updateActiveSceneToEditView3D()
if (!m_editView3DSetupDone)
return;
QVariant activeSceneVar = objectToVariant(m_active3DScene);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Active scene change handling on qml side is async, so a deleted importScene would crash
// editView when it updates next. Disable/enable edit view update synchronously to avoid this.
QVariant activeSceneVar = objectToVariant(m_active3DScene);
QMetaObject::invokeMethod(m_editView3DData.rootItem, "enableEditViewUpdate",
Q_ARG(QVariant, activeSceneVar));
#endif
ServerNodeInstance sceneInstance = active3DSceneInstance();
const QString sceneId = sceneInstance.id();