remove listener on dispose: reference to myDialog may remain inside swing caches...
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Wed, 19 Aug 2015 13:17:48 +0000 (16:17 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Wed, 19 Aug 2015 13:21:34 +0000 (16:21 +0300)
platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java

index 5f78c056dbacb15b6f3fb736ec2e36734cb4e04a..2e47619ace92ffbb0398e122ae30f5300a2fb173 100644 (file)
@@ -1182,7 +1182,7 @@ public abstract class DialogWrapper {
     ensureEventDispatchThread();
     myErrorText = new ErrorText();
     myErrorText.setVisible(false);
-    myErrorText.myLabel.addComponentListener(new ComponentAdapter() {
+    final ComponentAdapter resizeListener = new ComponentAdapter() {
       private int myHeight;
 
       @Override
@@ -1203,6 +1203,13 @@ public abstract class DialogWrapper {
           myResizeInProgress = false;
         }
       }
+    };
+    myErrorText.myLabel.addComponentListener(resizeListener);
+    Disposer.register(myDisposable, new Disposable() {
+      @Override
+      public void dispose() {
+        myErrorText.myLabel.removeComponentListener(resizeListener);
+      }
     });
 
     final JPanel root = new JPanel(createRootLayout());