Skip to content

Commit 2e1facd

Browse files
committed
Don't use Display.syncExec() for refresh in RuntimeClasspathViewer
The listener may be called from a background thread that already holds some locks. To refresh RuntimeClasspathViewer UI in the current case, syncExec is not needed, asyncExec is enough and it would not acquire the UI lock from an unknown thread. Fixes #672
1 parent 093343f commit 2e1facd

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/classpath/RuntimeClasspathViewer.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,7 @@ public class RuntimeClasspathViewer implements IClasspathViewer {
6464

6565
@Override
6666
public void preferenceChange(PreferenceChangeEvent event) {
67-
if (DebugUIPlugin.getStandardDisplay().getThread().equals(Thread.currentThread())) {
68-
refresh(true);
69-
} else {
70-
DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
71-
@Override
72-
public void run() {
73-
refresh(true);
74-
}
75-
});
76-
}
77-
67+
DebugUIPlugin.getStandardDisplay().asyncExec(() -> refresh(true));
7868
}
7969
};
8070

@@ -395,6 +385,9 @@ public void setSelection(ISelection selection) {
395385

396386
@Override
397387
public void refresh(Object entry) {
388+
if (fTree.isDisposed()) {
389+
return;
390+
}
398391
getTreeViewer().refresh();
399392
}
400393

0 commit comments

Comments
 (0)