summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-04-15 15:26:54 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-17 08:06:07 +0000
commitc56681e130e76f8122ef1d08ef3b7f1d36d07956 (patch)
tree9e5bdc647a5e71b386386cd6566dcf73af06265f /server/src/com/vaadin/ui
parent3d703e9c3eba8d9da3aebb5166ad24bf0368421a (diff)
downloadvaadin-framework-c56681e130e76f8122ef1d08ef3b7f1d36d07956.tar.gz
vaadin-framework-c56681e130e76f8122ef1d08ef3b7f1d36d07956.zip
Don't assign PushConnection to UI before it has been connected (#11506)
Change-Id: I728c830d6740f77a200ea69925772924e58f45a4
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r--server/src/com/vaadin/ui/UI.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 303dfc234a..1fb7ace9df 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -482,6 +482,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
private PushConnection pushConnection = null;
+ private boolean hasPendingPush = false;
+
/**
* This method is used by Component.Focusable objects to request focus to
* themselves. Focus renders must be handled at window level (instead of
@@ -1149,6 +1151,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
public void push() {
VaadinSession session = getSession();
if (session != null) {
+ assert session.hasLock();
if (!getConnectorTracker().hasDirtyConnectors()) {
// Do not push if there is nothing to push
return;
@@ -1157,8 +1160,12 @@ public abstract class UI extends AbstractSingleComponentContainer implements
if (session.getPushMode() == PushMode.DISABLED) {
throw new IllegalStateException("Push not enabled");
}
- assert pushConnection != null;
- pushConnection.push();
+
+ if (pushConnection == null) {
+ hasPendingPush = true;
+ } else {
+ pushConnection.push();
+ }
} else {
throw new UIDetachedException("Trying to push a detached UI");
}
@@ -1180,6 +1187,10 @@ public abstract class UI extends AbstractSingleComponentContainer implements
assert pushConnection == null;
assert connection != null;
pushConnection = connection;
+ if (hasPendingPush) {
+ hasPendingPush = false;
+ pushConnection.push();
+ }
}
/**