Commit a3599907 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Ensure moving ranges are cleaned up

parent b399d751
......@@ -8,12 +8,17 @@
void SemanticHighlighter::remove(const QUrl &url)
{
m_docUrlToResultId.remove(url);
auto &data = m_docSemanticInfo[url];
auto &movingRanges = data.movingRanges;
auto it = m_docSemanticInfo.find(url);
if (it == m_docSemanticInfo.end()) {
return;
}
auto &movingRanges = it->movingRanges;
for (auto mr : movingRanges) {
delete mr;
}
m_docUrlToResultId.remove(url);
m_docSemanticInfo.remove(url);
}
void SemanticHighlighter::insert(const QUrl &url, const QString &resultId, const std::vector<uint32_t> &data)
......
......@@ -15,13 +15,6 @@ class SemanticTokensLegend;
class SemanticHighlighter
{
public:
~SemanticHighlighter()
{
for (auto &info : m_docSemanticInfo) {
qDeleteAll(info.movingRanges.begin(), info.movingRanges.end());
}
}
/**
* Does the actual highlighting
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment