Skip to content

Commit

Permalink
Issue a read lock lock when necessary (#1759)
Browse files Browse the repository at this point in the history
Found to be necessary when triggering a manual find usages
  • Loading branch information
ahus1 committed Dec 30, 2024
1 parent ac1906d commit 050e193
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ public class AsciiDocProcessUtil {
public static void runInReadActionWithWriteActionPriority(Runnable runnable) {
if (ApplicationManager.getApplication().isDispatchThread()) {
ApplicationManager.getApplication().runReadAction(runnable);
} else if (ApplicationManager.getApplication().isReadAccessAllowed() && ProgressManager.getInstance().getProgressIndicator() != null) {
runnable.run();
} else if (ProgressManager.getInstance().getProgressIndicator() != null) {
if (ApplicationManager.getApplication().isReadAccessAllowed()) {
runnable.run();
} else {
ApplicationManager.getApplication().runReadAction(runnable);
}
} else {
retryable(() -> ReadAction.computeCancellable(() -> {
runnable.run();
Expand All @@ -48,8 +52,12 @@ public static void runInReadActionWithWriteActionPriority(Runnable runnable) {
public static <T> T runInReadActionWithWriteActionPriority(Computable<T> computable) {
if (ApplicationManager.getApplication().isDispatchThread()) {
return ApplicationManager.getApplication().runReadAction(computable);
} else if (ApplicationManager.getApplication().isReadAccessAllowed() && ProgressManager.getInstance().getProgressIndicator() != null) {
return computable.compute();
} else if (ProgressManager.getInstance().getProgressIndicator() != null) {
if (ApplicationManager.getApplication().isReadAccessAllowed()) {
return computable.compute();
} else {
return ApplicationManager.getApplication().runReadAction(computable);
}
} else {
return retryable(() -> ReadAction.computeCancellable(computable::compute));
}
Expand Down

0 comments on commit 050e193

Please sign in to comment.