diff options
author | Tim Jenssen <tim.jenssen@digia.com> | 2014-10-16 13:56:47 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2014-10-22 11:29:30 +0200 |
commit | 49c39eb02919f70a345056aacd07d9ae57eb9be3 (patch) | |
tree | d662080fa6fdacf866cad77a25bf8606b84346a5 /share | |
parent | 26bf2caa59b8f7ea95e551fec775c81143f8a6bb (diff) | |
download | qt-creator-49c39eb02919f70a345056aacd07d9ae57eb9be3.tar.gz |
QmlDesigner: create DesignerSupport on stack
- it has the same life cycle like the Qt5NodeInstanceServer
- we don't need to create and delete it (with maybe memory leaks)
- this fixes a crash while the puppet is closed after an item deletion
Change-Id: Iecd6515eb41324b95e99e151d77ee74895230182
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp | 12 | ||||
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h | 6 |
2 files changed, 6 insertions, 12 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp index bbf43e5da3..3fbc7ac0e0 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.cpp @@ -42,8 +42,7 @@ namespace QmlDesigner { Qt5NodeInstanceServer::Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) - : NodeInstanceServer(nodeInstanceClient), - m_designerSupport(new DesignerSupport) + : NodeInstanceServer(nodeInstanceClient) { DesignerSupport::activateDesignerMode(); } @@ -51,8 +50,6 @@ Qt5NodeInstanceServer::Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeIn Qt5NodeInstanceServer::~Qt5NodeInstanceServer() { delete quickView(); - delete m_designerSupport; - m_designerSupport = 0; } QQuickView *Qt5NodeInstanceServer::quickView() const @@ -128,21 +125,18 @@ void Qt5NodeInstanceServer::refreshBindings() DesignerSupport::refreshExpressions(context()); } -DesignerSupport *Qt5NodeInstanceServer::designerSupport() const +DesignerSupport *Qt5NodeInstanceServer::designerSupport() { - return m_designerSupport; + return &m_designerSupport; } void Qt5NodeInstanceServer::createScene(const CreateSceneCommand &command) { - m_designerSupport = new DesignerSupport; NodeInstanceServer::createScene(command); } void Qt5NodeInstanceServer::clearScene(const ClearSceneCommand &command) { - delete m_designerSupport; - m_designerSupport = 0; NodeInstanceServer::clearScene(command); } diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h index 987f781d6c..2bdd39fb42 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5nodeinstanceserver.h @@ -34,10 +34,10 @@ #include <QtGlobal> #include "nodeinstanceserver.h" +#include "designersupport.h" QT_BEGIN_NAMESPACE class QQuickItem; -class DesignerSupport; QT_END_NAMESPACE namespace QmlDesigner { @@ -54,7 +54,7 @@ public: QQmlEngine *engine() const Q_DECL_OVERRIDE; void refreshBindings() Q_DECL_OVERRIDE; - DesignerSupport *designerSupport() const; + DesignerSupport *designerSupport(); void createScene(const CreateSceneCommand &command) Q_DECL_OVERRIDE; void clearScene(const ClearSceneCommand &command) Q_DECL_OVERRIDE; @@ -69,7 +69,7 @@ protected: private: QPointer<QQuickView> m_quickView; - DesignerSupport *m_designerSupport; + DesignerSupport m_designerSupport; }; } // QmlDesigner |