Prevent possible memory leak

This commit is contained in:
tsareg 2016-06-21 17:39:00 +03:00
parent 8b528b582f
commit 375b145030
2 changed files with 12 additions and 2 deletions

View File

@ -1289,6 +1289,12 @@ UI.showDeviceErrorDialog = function (micError, cameraError) {
input.prop("checked"); input.prop("checked");
} }
} }
},
null,
function () {
// Reset dialog reference to null to avoid memory leaks when
// user closed the dialog manually.
deviceErrorDialog = null;
} }
); );

View File

@ -113,9 +113,10 @@ var messageHandler = {
* @param submitFunction function to be called on submit * @param submitFunction function to be called on submit
* @param loadedFunction function to be called after the prompt is fully * @param loadedFunction function to be called after the prompt is fully
* loaded * loaded
* @param closeFunction function to be called on dialog close
*/ */
openDialog: function (titleString, msgString, persistent, buttons, openDialog: function (titleString, msgString, persistent, buttons,
submitFunction, loadedFunction) { submitFunction, loadedFunction, closeFunction) {
if (!popupEnabled) if (!popupEnabled)
return; return;
@ -125,11 +126,14 @@ var messageHandler = {
buttons: buttons, buttons: buttons,
defaultButton: 1, defaultButton: 1,
loaded: loadedFunction, loaded: loadedFunction,
submit: submitFunction submit: submitFunction,
close: closeFunction
}; };
if (persistent) { if (persistent) {
args.closeText = ''; args.closeText = '';
} }
return new Impromptu(msgString, args); return new Impromptu(msgString, args);
}, },