diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index c8e4ec016..24a4c8132 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -202,6 +202,12 @@ VDomDocument::VDomDocument(QObject *parent) connect(m_watcher, &QFutureWatcher>::finished, this, &VDomDocument::CacheRefreshed); } +//--------------------------------------------------------------------------------------------------------------------- +VDomDocument::~VDomDocument() +{ + m_watcher->cancel(); +} + //--------------------------------------------------------------------------------------------------------------------- QDomElement VDomDocument::elementById(quint32 id, const QString &tagName) { @@ -608,7 +614,10 @@ void VDomDocument::CollectId(const QDomElement &node, QVector &vector) //--------------------------------------------------------------------------------------------------------------------- void VDomDocument::RefreshElementIdCache() { - m_watcher->setFuture(QtConcurrent::run(this, &VDomDocument::RefreshCache, documentElement())); + if (m_watcher->isFinished()) + { + m_watcher->setFuture(QtConcurrent::run(this, &VDomDocument::RefreshCache, documentElement())); + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/ifc/xml/vdomdocument.h b/src/libs/ifc/xml/vdomdocument.h index 7d4dd20f0..623f1f442 100644 --- a/src/libs/ifc/xml/vdomdocument.h +++ b/src/libs/ifc/xml/vdomdocument.h @@ -95,7 +95,7 @@ public: static const QString TagLine; explicit VDomDocument(QObject *parent = nullptr); - virtual ~VDomDocument() Q_DECL_EQ_DEFAULT; + virtual ~VDomDocument(); QDomElement elementById(quint32 id, const QString &tagName = QString()); template