bug 385086: followup patch to null more XPCOM components that could potentially cause leaks and also clear structures of observers to avoid cycles in the event the observers don't remove themselves

r=sayrer
This commit is contained in:
myk@mozilla.org 2007-06-21 11:52:35 -07:00
Родитель 163364d859
Коммит 90dffc280d
3 изменённых файлов: 20 добавлений и 2 удалений

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

@ -84,7 +84,14 @@ var ContentPrefSink = {
gBrowser.removeEventListener("DOMContentLoaded", this, false);
gBrowser.removeProgressListener(this);
this._observers = null;
// Delete reference to an XPCOM component to make sure we don't leak it
// (although we haven't observed leakage in tests).
this.__cps = null;
// Delete references to observers to avoid cycles with those that refer
// to us and don't remove themselves from the observer pool.
this._observers = {};
this._genericObservers = [];
},

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

@ -133,6 +133,11 @@ var TextZoom = {
ContentPrefSink.removeObserver(this.name, this);
this._cps.removeObserver(this.name, this);
window.removeEventListener("DOMMouseScroll", this, false);
// Delete references to XPCOM components to make sure we don't leak them
// (although we haven't observed leakage in tests).
this.__cps = null;
this.__prefBranch = null;
},

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

@ -81,7 +81,8 @@ ContentPrefService.prototype = {
_destroy: function ContentPrefService__destroy() {
this._observerSvc.removeObserver(this, "xpcom-shutdown");
// Delete various references to XPCOM components so we don't leak them.
// Delete references to XPCOM components to make sure we don't leak them
// (although we haven't observed leakage in tests).
this.__observerSvc = null;
this.__consoleSvc = null;
this._grouper = null;
@ -101,6 +102,11 @@ ContentPrefService.prototype = {
this.__stmtSelectPrefs = null;
this.__stmtSelectGlobalPrefs = null;
this._dbConnection = null;
// Delete references to observers to avoid cycles with those that refer
// to us and don't remove themselves from the observer pool.
this._observers = {};
this._genericObservers = [];
},