mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
data race when HighlightingSession disposed but HighlightingSessionImpl.myAddHighlighterInEDTQueue didn't apply all its highlighters yet
This commit is contained in:
+10
-1
@@ -17,6 +17,7 @@
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
@@ -151,8 +152,16 @@ public abstract class ProgressableTextEditorHighlightingPass extends TextEditorH
|
||||
}
|
||||
}
|
||||
|
||||
void waitForHighlightInfosApplied() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
HighlightingSessionImpl session = (HighlightingSessionImpl)myHighlightingSession;
|
||||
if (session != null) {
|
||||
session.waitForHighlightInfosApplied();
|
||||
}
|
||||
}
|
||||
|
||||
static class EmptyPass extends TextEditorHighlightingPass {
|
||||
public EmptyPass(final Project project, @Nullable final Document document) {
|
||||
EmptyPass(final Project project, @Nullable final Document document) {
|
||||
super(project, document, false);
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -517,6 +517,9 @@ class PassExecutorService implements Disposable {
|
||||
throw new RuntimeException(message, e);
|
||||
}
|
||||
if (threadsToStartCountdown.decrementAndGet() == 0) {
|
||||
if (pass instanceof ProgressableTextEditorHighlightingPass) {
|
||||
((ProgressableTextEditorHighlightingPass)pass).waitForHighlightInfosApplied();
|
||||
}
|
||||
log(updateProgress, pass, "Stopping ");
|
||||
updateProgress.stopIfRunning();
|
||||
}
|
||||
@@ -543,7 +546,7 @@ class PassExecutorService implements Disposable {
|
||||
}
|
||||
|
||||
private static void sortById(@NotNull List<TextEditorHighlightingPass> result) {
|
||||
ContainerUtil.quickSort(result, (o1, o2) -> o1.getId() - o2.getId());
|
||||
ContainerUtil.quickSort(result, Comparator.comparingInt(TextEditorHighlightingPass::getId));
|
||||
}
|
||||
|
||||
private static int getThreadNum() {
|
||||
|
||||
Reference in New Issue
Block a user