diff options
author | Antti Määttä <antti.maatta@qt.io> | 2019-04-24 15:15:12 +0300 |
---|---|---|
committer | Antti Määttä <antti.maatta@qt.io> | 2019-04-24 13:00:23 +0000 |
commit | 21fa0acd255e5e55dad0ffc1fc6553e739c3276c (patch) | |
tree | 506c8b9bd6e41f82dbcc14fd0a6bf130853c5dd7 /src/Runtime | |
parent | 01c856feea3eb1d3265e4e900d830e39df4a38b8 (diff) |
Fix crash in editor when using qml stream
The crash occurs due to stack overflow due to recursive subpresentation
initialization in runtime codes. This happens because the qml
subpresentation has the same id as the presentation filename, which is
assigned to default initial id from the presentation filename. When the
layer, which is using the qml subpresentation, is initialized in the
runtime, it gets the uip presentation instead of the qml subpresentation.
The same begins to happen recursively.
Add the ability to change the initial presentation id from the surface
viewer api, which is used to render the subpresentations in the editor so
that it gets valid id instead of the id from filename.
Task-number: QT3DS-3345
Change-Id: I45f3a8ce9b5dc030f120baa1a8aed6c284ea7e3c
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Diffstat (limited to 'src/Runtime')
-rw-r--r-- | src/Runtime/Source/engine/Qt3DSTegraApplication.cpp | 5 | ||||
-rw-r--r-- | src/Runtime/Source/engine/Qt3DSTegraApplication.h | 6 | ||||
-rw-r--r-- | src/Runtime/Source/runtime/Qt3DSApplication.cpp | 8 | ||||
-rw-r--r-- | src/Runtime/Source/runtime/Qt3DSApplication.h | 1 | ||||
-rw-r--r-- | src/Runtime/Source/viewer/Qt3DSViewerApp.cpp | 8 | ||||
-rw-r--r-- | src/Runtime/Source/viewer/Qt3DSViewerApp.h | 2 |
6 files changed, 29 insertions, 1 deletions
diff --git a/src/Runtime/Source/engine/Qt3DSTegraApplication.cpp b/src/Runtime/Source/engine/Qt3DSTegraApplication.cpp index 663fe836..b85cbd32 100644 --- a/src/Runtime/Source/engine/Qt3DSTegraApplication.cpp +++ b/src/Runtime/Source/engine/Qt3DSTegraApplication.cpp @@ -205,6 +205,11 @@ public: void SetDataInputValue(const QString &name, const QVariant &value, Q3DSDataInput::ValueRole property) override; + void setPresentationId(const QString &id) override + { + m_Application->setPresentationId(id); + } + QList<QString> dataInputs() const override; float dataInputMax(const QString &name) const override; float dataInputMin(const QString &name) const override; diff --git a/src/Runtime/Source/engine/Qt3DSTegraApplication.h b/src/Runtime/Source/engine/Qt3DSTegraApplication.h index 75b6058b..d68e9efa 100644 --- a/src/Runtime/Source/engine/Qt3DSTegraApplication.h +++ b/src/Runtime/Source/engine/Qt3DSTegraApplication.h @@ -174,6 +174,8 @@ public: // loading virtual INT32 GetFrameCount() = 0; virtual void showOnScreenStats(bool) = 0; + virtual void setPresentationId(const QString &id) = 0; + public: // Input engine access virtual CInputEngine *GetInputEngine() = 0; // Only valid after InitializeGraphics @@ -334,6 +336,10 @@ public: { return m_NDDView; } + void setPresentationId(const QString &id) + { + m_NDDView->setPresentationId(id); + } }; } // namespace Q3DStudio diff --git a/src/Runtime/Source/runtime/Qt3DSApplication.cpp b/src/Runtime/Source/runtime/Qt3DSApplication.cpp index 6e7a2eb8..ac7ee76e 100644 --- a/src/Runtime/Source/runtime/Qt3DSApplication.cpp +++ b/src/Runtime/Source/runtime/Qt3DSApplication.cpp @@ -565,6 +565,11 @@ struct SApp : public IApplication } } + void setPresentationId(const QString &id) override + { + m_InitialPresentationId.assign(qPrintable(id)); + } + void setAssetVisitor(qt3ds::Qt3DSAssetVisitor *v) override { m_visitor = v; @@ -1348,7 +1353,8 @@ struct SApp : public IApplication #if !defined(_LINUXPLATFORM) && !defined(_INTEGRITYPLATFORM) ConnectDebugger(); #endif - m_InitialPresentationId.assign(filename.c_str()); + if (m_InitialPresentationId.empty()) + m_InitialPresentationId.assign(filename.c_str()); eastl::string relativePath = "./"; relativePath.append(filename); relativePath.append("."); diff --git a/src/Runtime/Source/runtime/Qt3DSApplication.h b/src/Runtime/Source/runtime/Qt3DSApplication.h index f0ccb175..d4dba733 100644 --- a/src/Runtime/Source/runtime/Qt3DSApplication.h +++ b/src/Runtime/Source/runtime/Qt3DSApplication.h @@ -241,6 +241,7 @@ public: virtual float dataInputMin(const QString &name) const = 0; + virtual void setPresentationId(const QString &id) = 0; }; } } diff --git a/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp b/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp index 853a58ac..2b5c0af1 100644 --- a/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp +++ b/src/Runtime/Source/viewer/Qt3DSViewerApp.cpp @@ -754,6 +754,14 @@ void Q3DSViewerApp::SetDataInputValue( m_Impl.m_tegraApp->SetDataInputValue(name, value, valueRole); } +void Q3DSViewerApp::setPresentationId(const QString &id) +{ + if (!m_Impl.m_tegraApp) + return; + + m_Impl.m_tegraApp->setPresentationId(id); +} + QList<QString> Q3DSViewerApp::dataInputs() const { if (!m_Impl.m_tegraApp) diff --git a/src/Runtime/Source/viewer/Qt3DSViewerApp.h b/src/Runtime/Source/viewer/Qt3DSViewerApp.h index 4cc15def..df034653 100644 --- a/src/Runtime/Source/viewer/Qt3DSViewerApp.h +++ b/src/Runtime/Source/viewer/Qt3DSViewerApp.h @@ -358,6 +358,8 @@ public: QString error(); + void setPresentationId(const QString &id); + private: /* * @brief parse command line arguments this fills in our |