mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
fixing deadlocks when isUpToDate() is called from Swing thread
This commit is contained in:
@@ -135,6 +135,7 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
try {
|
||||
|
||||
try {
|
||||
final Application app = ApplicationManager.getApplication();
|
||||
while (!acquired) {
|
||||
acquired = semaphore.tryAcquire(500, TimeUnit.MILLISECONDS);
|
||||
if (indicator.isCanceled()) {
|
||||
@@ -142,6 +143,9 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
// let compile work begin in order to stop gracefuly on cancel event
|
||||
break;
|
||||
}
|
||||
if (app.isDispatchThread()) {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InterruptedException ignored) {
|
||||
|
||||
@@ -1529,7 +1529,6 @@ public class UIUtil {
|
||||
g.setComposite(X_RENDER_ACTIVE.getValue() ? AlphaComposite.SrcOver : AlphaComposite.Src);
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void dispatchAllInvocationEvents() {
|
||||
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
|
||||
final EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
|
||||
Reference in New Issue
Block a user