Skip to content

Commit af7cdc3

Browse files
committed
Fix race condition in WorkbenchPluginTest eclipse-platform#1891
Test test case testGetImageRegistryFromAdditionalDisplay() in org.eclipse.ui.tests.api.WorkbenchPluginTest randomly fails because of a race condition. A display is initialized in another thread, but the initialization logic may access the value before it has actually been set by the other thread. This is fixed by reordering the instructions. Fixes eclipse-platform#1891
1 parent 30bc1dc commit af7cdc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/WorkbenchPluginTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ private Display initializeDisplayInOtherThread() {
7373
TestBarrier2 displayCreationBarrier = new TestBarrier2();
7474
new Thread(() -> {
7575
Display display = new Display();
76-
displayCreationBarrier.setStatus(TestBarrier2.STATUS_DONE);
7776
displayReference.set(display);
77+
displayCreationBarrier.setStatus(TestBarrier2.STATUS_DONE);
7878
while (!display.isDisposed()) {
7979
if (!display.readAndDispatch()) {
8080
display.sleep();

0 commit comments

Comments
 (0)