Sfoglia il codice sorgente

Prevent possible memory leak

j8
tsareg 9 anni fa
parent
commit
375b145030
2 ha cambiato i file con 12 aggiunte e 2 eliminazioni
  1. 6
    0
      modules/UI/UI.js
  2. 6
    2
      modules/UI/util/MessageHandler.js

+ 6
- 0
modules/UI/UI.js Vedi File

1289
                         input.prop("checked");
1289
                         input.prop("checked");
1290
                 }
1290
                 }
1291
             }
1291
             }
1292
+        },
1293
+        null,
1294
+        function () {
1295
+            // Reset dialog reference to null to avoid memory leaks when
1296
+            // user closed the dialog manually.
1297
+            deviceErrorDialog = null;
1292
         }
1298
         }
1293
     );
1299
     );
1294
 
1300
 

+ 6
- 2
modules/UI/util/MessageHandler.js Vedi File

113
      * @param submitFunction function to be called on submit
113
      * @param submitFunction function to be called on submit
114
      * @param loadedFunction function to be called after the prompt is fully
114
      * @param loadedFunction function to be called after the prompt is fully
115
      *        loaded
115
      *        loaded
116
+     * @param closeFunction function to be called on dialog close
116
      */
117
      */
117
     openDialog: function (titleString, msgString, persistent, buttons,
118
     openDialog: function (titleString, msgString, persistent, buttons,
118
-                              submitFunction, loadedFunction) {
119
+                              submitFunction, loadedFunction, closeFunction) {
119
         if (!popupEnabled)
120
         if (!popupEnabled)
120
             return;
121
             return;
121
 
122
 
125
             buttons: buttons,
126
             buttons: buttons,
126
             defaultButton: 1,
127
             defaultButton: 1,
127
             loaded: loadedFunction,
128
             loaded: loadedFunction,
128
-            submit: submitFunction
129
+            submit: submitFunction,
130
+            close: closeFunction
129
         };
131
         };
132
+
130
         if (persistent) {
133
         if (persistent) {
131
             args.closeText = '';
134
             args.closeText = '';
132
         }
135
         }
136
+        
133
         return new Impromptu(msgString, args);
137
         return new Impromptu(msgString, args);
134
     },
138
     },
135
 
139
 

Loading…
Annulla
Salva