summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
index 12ce828f47..9603310e22 100644
--- a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
@@ -433,11 +433,17 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
// This had to be here because we might not know the content size before
// everything is painted into the window
- // centered is this is unset on move/resize
+ // centered if this is unset on move/resize
window.centered = state.centered;
// Ensure centering before setting visible (#16486)
if (window.centered && getState().windowMode != WindowMode.MAXIMIZED) {
- Scheduler.get().scheduleFinally(() -> getWidget().center());
+ Scheduler.get().scheduleFinally(() -> {
+ // the window may have got removed again before this is
+ // triggered, and centering would re-display it
+ if (getWidget().isShowing()) {
+ getWidget().center();
+ }
+ });
}
window.setVisible(true);
}