Bundle: fix memory leak at init/reset
[fanfix.git] / ui / WaitingDialog.java
index 15dca6cce1655352e72ebba268086c6c239cdcca..0fd4574d893aa5e5650e4adc73e83ae9efba15ae 100644 (file)
@@ -93,6 +93,8 @@ public class WaitingDialog extends JDialog {
                        String waitingText) {
                super(parent);
 
+               this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+
                this.pg = pg;
 
                if (waitingText != null) {
@@ -154,6 +156,8 @@ public class WaitingDialog extends JDialog {
        /**
         * Notify this {@link WaitingDialog} that the job is done, and dismiss it if
         * it was already showing on screen (or never show it if it was not).
+        * <p>
+        * Will also dispose the {@link WaitingDialog}.
         */
        public void dismiss() {
                synchronized (waitLock) {
@@ -166,5 +170,7 @@ public class WaitingDialog extends JDialog {
                if (pg != null) {
                        pg.removeProgressListener(pgl);
                }
+
+               dispose();
        }
 }