]> source.dussan.org Git - vaadin-framework.git/commitdiff
#7058 Ensure shadow is always removed when the overlay is removed
authorArtur Signell <artur.signell@itmill.com>
Thu, 26 May 2011 13:24:23 +0000 (13:24 +0000)
committerArtur Signell <artur.signell@itmill.com>
Thu, 26 May 2011 13:24:23 +0000 (13:24 +0000)
svn changeset:19098/svn branch:6.6

src/com/vaadin/terminal/gwt/client/ui/VOverlay.java

index aba7ccf2172406637fb9cd6f883b7dea51f4db21..f9e8aa1f6b239ab13c019f62049f461a2247a68b 100644 (file)
@@ -92,15 +92,20 @@ public class VOverlay extends PopupPanel {
 
             addCloseHandler(new CloseHandler<PopupPanel>() {
                 public void onClose(CloseEvent<PopupPanel> event) {
-                    if (shadow.getParentElement() != null) {
-                        shadow.getParentElement().removeChild(shadow);
-                    }
+                    removeShadowIfPresent();
                 }
             });
         }
         adjustZIndex();
     }
 
+    private void removeShadowIfPresent() {
+        if (shadow != null && shadow.getParentElement() != null) {
+            shadow.getParentElement().removeChild(shadow);
+        }
+
+    }
+
     private void adjustZIndex() {
         setZIndex(Z_INDEX);
     }
@@ -179,6 +184,14 @@ public class VOverlay extends PopupPanel {
         Util.runIE7ZeroSizedBodyFix();
     }
 
+    @Override
+    protected void onDetach() {
+        super.onDetach();
+
+        // Always ensure shadow is removed when the overlay is removed.
+        removeShadowIfPresent();
+    }
+
     @Override
     public void setVisible(boolean visible) {
         super.setVisible(visible);