forked from qt-creator/qt-creator
Clang: Fix occasional hang in ~SemanticHighlighter
A code path existed for which QFutureInterface<T>::reportFinished() was not called. Change-Id: I968c6b8cc92b9bfd49570405502da94bda8c7b56 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "cppcreatemarkers.h"
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/runextensions.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -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<ClangCodeModel::SourceMarker> 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.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user