Fix leaks caused by cyclical ownership and XPCOM timers. b=315951 r=mconnor

This commit is contained in:
dbaron%dbaron.org 2005-12-28 00:33:23 +00:00
Родитель b0427a1cae
Коммит 4707ddb5aa
3 изменённых файлов: 26 добавлений и 7 удалений

Просмотреть файл

@ -381,8 +381,10 @@ nsHelperAppDialog.prototype = {
_timer: null,
notify: function (aTimer) {
try { // The user may have already canceled the dialog.
if (!this._blurred)
this.mDialog.document.documentElement.getButton('accept').disabled = false;
} catch (ex) {}
this._timer = null;
},

Просмотреть файл

@ -606,6 +606,20 @@
]]>
</constructor>
<destructor>
<![CDATA[
// Release timers to avoid reference cycles.
if (this._animateTimer) {
this._animateTimer.cancel();
this._animateTimer = null;
}
if (this._fadeTimer) {
this._fadeTimer.cancel();
this._fadeTimer = null;
}
]]>
</destructor>
<field name="instantApply">false</field>
<property name="preferencePanes"
@ -806,10 +820,10 @@
this._setUpFadeTimer();
}
} else if (aTimer == this._fadeTimer) {
var lastSelectedPane = document.getElementById(this.lastSelected);
var elt = document.getElementById(this.lastSelected);
if (parseFloat(window.getComputedStyle(lastSelectedPane, "").opacity) < (1.0 - this._fadeIncrement))
elt.style.opacity = parseFloat(window.getComputedStyle(elt, "").opacity) + this._fadeIncrement;
var newOpacity = parseFloat(window.getComputedStyle(elt, "").opacity) + this._fadeIncrement;
if (newOpacity < 1.0)
elt.style.opacity = newOpacity;
else {
aTimer.cancel();
elt.style.opacity = 1.0;

Просмотреть файл

@ -450,9 +450,12 @@ nsUnknownContentTypeDialog.prototype = {
_timer: null,
notify: function (aTimer) {
try { // The user may have already canceled the dialog.
if (!this._blurred)
this.mDialog.document.documentElement.getButton('accept').disabled = false;
} catch (ex) {}
this._delayExpired = true;
this._timer = null; // the timer won't release us, so we have to release it
},
postShowCallback: function () {