From 7211b7abf206927a316e0ffbfc20ecdb530c8a65 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 6 Aug 2021 15:58:03 +0300 Subject: [PATCH] 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 --- .../qml/qmlpuppet/mockfiles/qt6/EditView3D.qml | 10 ---------- .../instances/qt5informationnodeinstanceserver.cpp | 5 +++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml index 83e37050402..d79f1c0f5fb 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/qt6/EditView3D.qml @@ -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) { diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 94f71cd52ff..b48f37b07c1 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -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();