forked from qt-creator/qt-creator
QmlDesigner: Fix double creation of DVConnector
DVConnector is created twice once for the toolbar instance and another time for the statusbar instance in QML. Fix this by making the DVConnector a static unique_ptr. Change-Id: Ib8dc18154bbb7915860d182dd5b66626bc3e60d6 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
43f9c2abbc
commit
14a5675e23
@@ -48,6 +48,8 @@
|
|||||||
|
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
static Internal::DesignModeWidget *designModeWidget()
|
static Internal::DesignModeWidget *designModeWidget()
|
||||||
@@ -349,6 +351,10 @@ void ActionSubscriber::setupNotifier()
|
|||||||
emit tooltipChanged();
|
emit tooltipChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DVCONNECTOR_ENABLED
|
||||||
|
static std::unique_ptr<DesignViewer::DVConnector> s_designViewerConnector;
|
||||||
|
#endif
|
||||||
|
|
||||||
ToolBarBackend::ToolBarBackend(QObject *parent)
|
ToolBarBackend::ToolBarBackend(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
@@ -929,7 +935,10 @@ QString ToolBarBackend::runManagerError() const
|
|||||||
#ifdef DVCONNECTOR_ENABLED
|
#ifdef DVCONNECTOR_ENABLED
|
||||||
DesignViewer::DVConnector *ToolBarBackend::designViewerConnector()
|
DesignViewer::DVConnector *ToolBarBackend::designViewerConnector()
|
||||||
{
|
{
|
||||||
return &m_designViewerConnector;
|
if (!s_designViewerConnector)
|
||||||
|
s_designViewerConnector = std::make_unique<DesignViewer::DVConnector>();
|
||||||
|
|
||||||
|
return s_designViewerConnector.get();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -232,9 +232,6 @@ private:
|
|||||||
|
|
||||||
QStringList m_openDocuments;
|
QStringList m_openDocuments;
|
||||||
QMetaObject::Connection m_kitConnection;
|
QMetaObject::Connection m_kitConnection;
|
||||||
#ifdef DVCONNECTOR_ENABLED
|
|
||||||
DesignViewer::DVConnector m_designViewerConnector;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
Reference in New Issue
Block a user