]> source.dussan.org Git - vaadin-framework.git/commitdiff
Verify child info in state before attaching widgets (#10150) 22/222/2
authorLeif Åstrand <leif@vaadin.com>
Wed, 7 Nov 2012 08:50:14 +0000 (10:50 +0200)
committerLeif Åstrand <leif@vaadin.com>
Fri, 9 Nov 2012 07:41:31 +0000 (09:41 +0200)
Change-Id: If6677bd1fcfc6dadd09d5816b93a0206417facb3

client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java

index a4aac4fea3c8903fd22d5622da8ee234cd3a57c6..aa144928490c31da5d209807ae38458b4abd6f37 100644 (file)
@@ -210,15 +210,23 @@ public abstract class AbstractSplitPanelConnector extends
 
     @Override
     public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
+        /*
+         * When the connector gets detached, the state isn't updated but there's
+         * still a hierarchy change -> verify that the child from the state is
+         * still our child before attaching the widget. See #10150.
+         */
+
         Widget newFirstChildWidget = null;
-        if (getFirstChild() != null) {
-            newFirstChildWidget = getFirstChild().getWidget();
+        ComponentConnector firstChild = getFirstChild();
+        if (firstChild != null && firstChild.getParent() == this) {
+            newFirstChildWidget = firstChild.getWidget();
         }
         getWidget().setFirstWidget(newFirstChildWidget);
 
         Widget newSecondChildWidget = null;
-        if (getSecondChild() != null) {
-            newSecondChildWidget = getSecondChild().getWidget();
+        ComponentConnector secondChild = getSecondChild();
+        if (secondChild != null && secondChild.getParent() == this) {
+            newSecondChildWidget = secondChild.getWidget();
         }
         getWidget().setSecondWidget(newSecondChildWidget);
     }