Skip to content

Commit df8af2e

Browse files
committed
AbstractUserInterface: register viewer first
At the conclusion of DisplayViewer.view(UserInterface, Display), a Display.update() fires, which triggers a DisplayUpdatedEvent. Since the DisplayViewer.view happens on the EDT (in the Swing case), the Display.update() also happens on the EDT, the DisplayUpdatedEvent is published on the EDT immediately (via publishNow, which simply calls the code directly). Therefore, the DisplayUpdatedEvent happens _before_ any subsequent code after the DisplayViewer.view. So we need the new DisplayViewer to have already been registered with the service. Otherwise, the update will have no effect, because it does a lookup of a DisplayViewer for the the Display in question, which will still be null.
1 parent a99f2c8 commit df8af2e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/scijava/ui/AbstractUserInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ public void show(final Display<?> display) {
137137
threadService.queue(new Runnable() {
138138
@Override
139139
public void run() {
140-
finalViewer.view(AbstractUserInterface.this, display);
141140
uiService.addDisplayViewer(finalViewer);
141+
finalViewer.view(AbstractUserInterface.this, display);
142142
}
143143
});
144144
}

0 commit comments

Comments
 (0)