forked from qt-creator/qt-creator
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:
@@ -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) {
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user