reparse file on next EDT loop always to avoid potential locking in FileBasedIndexImpl (calling StorageGuard.enter#enter(true) and then StorageGuard.enter#enter(true) in stacktrace of the same thread leads to locking) (IDEA-CR-11333)

This commit is contained in:
Sergey Simonchik
2016-06-09 15:21:16 +03:00
parent 3180d68608
commit 05f737cef2
@@ -70,7 +70,10 @@ public final class LanguageSubstitutors extends LanguageExtension<LanguageSubsti
if (ApplicationManager.getApplication().isDispatchThread() && myReparsingInProgress) {
return; // avoid recursive reparsing
}
invokeLaterIfNeeded(new Runnable() {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
LOG.info("Reparsing " + file.getPath() + " because of language substitution " +
@@ -99,13 +102,4 @@ public final class LanguageSubstitutors extends LanguageExtension<LanguageSubsti
}
return lang;
}
private static void invokeLaterIfNeeded(@NotNull Runnable runnable, @NotNull ModalityState modalityState) {
if (ApplicationManager.getApplication().isDispatchThread()) {
runnable.run();
}
else if (!ApplicationManager.getApplication().isUnitTestMode()) {
ApplicationManager.getApplication().invokeLater(runnable, modalityState);
}
}
}