diff --git a/src/plugins/clangcodemodel/cppcreatemarkers.cpp b/src/plugins/clangcodemodel/cppcreatemarkers.cpp index 5a56b1e2fb2..a7518b355c3 100644 --- a/src/plugins/clangcodemodel/cppcreatemarkers.cpp +++ b/src/plugins/clangcodemodel/cppcreatemarkers.cpp @@ -32,6 +32,7 @@ #include "cppcreatemarkers.h" #include +#include #include #include @@ -77,6 +78,9 @@ CreateMarkers::~CreateMarkers() void CreateMarkers::run() { QMutexLocker lock(m_marker->mutex()); + + ::Utils::ExecuteOnDestruction reportFinishedOnDestruction([this]() { reportFinished(); }); + if (isCanceled()) return; @@ -86,23 +90,18 @@ void CreateMarkers::run() m_usages.clear(); - if (isCanceled()) { - reportFinished(); + if (isCanceled()) return; - } const QList markers = m_marker->sourceMarkersInRange(m_firstLine, m_lastLine); foreach (const ClangCodeModel::SourceMarker &m, markers) addUse(SourceMarker(m.location().line(), m.location().column(), m.length(), m.kind())); - if (isCanceled()) { - reportFinished(); + if (isCanceled()) return; - } flush(); - reportFinished(); qCDebug(log) << "Creating markers took" << t.elapsed() << "ms in total."; }