forked from qt-creator/qt-creator
Refactor HighlightingResultReporter
In some unlikely circumstances it may happen that HighlightingResultReporter might be destroyed before returning from the HighlightingResultReporter::start() function. This may lead to undefined behavior. Refactor the HighlightingResultReporter so that instead of using QRunnable subclass we define simple function returning the QFuture object directly. Change-Id: Ib833771a7e46e87c83d10b59ca056a0147fabe88 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -37,6 +37,8 @@
|
||||
#include <diagnosticcontainer.h>
|
||||
#include <sourcelocationcontainer.h>
|
||||
|
||||
#include <clangsupport/tokeninfocontainer.h>
|
||||
|
||||
#include <cppeditor/builtincursorinfo.h>
|
||||
#include <cppeditor/clangdiagnosticconfigsmodel.h>
|
||||
#include <cppeditor/compileroptionsbuilder.h>
|
||||
@@ -271,10 +273,7 @@ void ClangEditorDocumentProcessor::updateHighlighting(
|
||||
emit ifdefedOutBlocksUpdated(documentRevision, skippedPreprocessorBlocks);
|
||||
|
||||
m_semanticHighlighter.setHighlightingRunner(
|
||||
[tokenInfos]() {
|
||||
auto *reporter = new HighlightingResultReporter(tokenInfos);
|
||||
return reporter->start();
|
||||
});
|
||||
[tokenInfos]() { return highlightResults(tokenInfos); });
|
||||
m_semanticHighlighter.run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user