Fixes pseudo-memory-leak caused by adding a new window resize handler
every time a popup is shown, but not removing it. This was causing
particularly bad behavior on IE, where a translucent glass element
allocates a significant amount of memory.
Review by: jlabanca (desk check)

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7236 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/PopupPanel.java b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
index 63b616e..f247d68 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -145,6 +145,8 @@
      */
     private boolean glassShowing;
 
+    private HandlerRegistration resizeRegistration;
+
     /**
      * Create a new {@link ResizeAnimation}.
      * 
@@ -276,14 +278,19 @@
         if (curPanel.isGlassEnabled) {
           Document.get().getBody().appendChild(curPanel.glass);
           impl.onShow(curPanel.glass);
-          glassShowing = true;
 
-          Window.addResizeHandler(curPanel.glassResizer);
+          resizeRegistration = Window.addResizeHandler(curPanel.glassResizer);
           curPanel.glassResizer.onResize(null);
+
+          glassShowing = true;
         }
       } else if (glassShowing) {
         Document.get().getBody().removeChild(curPanel.glass);
         impl.onHide(curPanel.glass);
+
+        resizeRegistration.removeHandler();
+        resizeRegistration = null;
+
         glassShowing = false;
       }
     }