QmlDesigner: Fix mode switch crash

Task-number: QDS-8599
Change-Id: I4bebd2ff4f2ce93788743304ff335d118e23ce68
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2022-12-15 14:38:59 +01:00
committed by Henning Gründl
parent bf4a94d619
commit 8b1233c11e
2 changed files with 5 additions and 2 deletions

View File

@@ -136,7 +136,8 @@ NodeInstanceView::NodeInstanceView(ConnectionManagerInterface &connectionManager
m_resetTimer.setSingleShot(true); m_resetTimer.setSingleShot(true);
m_resetTimer.setInterval(100); m_resetTimer.setInterval(100);
QObject::connect(&m_resetTimer, &QTimer::timeout, [this] { QObject::connect(&m_resetTimer, &QTimer::timeout, [this] {
resetPuppet(); if (isAttached())
resetPuppet();
}); });
m_updateWatcherTimer.setSingleShot(true); m_updateWatcherTimer.setSingleShot(true);
m_updateWatcherTimer.setInterval(100); m_updateWatcherTimer.setInterval(100);

View File

@@ -559,6 +559,7 @@ void AbstractView::resetView()
void AbstractView::resetPuppet() void AbstractView::resetPuppet()
{ {
QTC_ASSERT(isAttached(), return);
emitCustomNotification(QStringLiteral("reset QmlPuppet")); emitCustomNotification(QStringLiteral("reset QmlPuppet"));
} }
@@ -689,7 +690,8 @@ void AbstractView::emitCustomNotification(const QString &identifier, const QList
void AbstractView::emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) void AbstractView::emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
{ {
model()->d->notifyCustomNotification(this, identifier, nodeList, data); if (model())
model()->d->notifyCustomNotification(this, identifier, nodeList, data);
} }
void AbstractView::emitInstancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) void AbstractView::emitInstancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)