Break the ownership cycle with nsUpdateNotifier's mTimer at shutdown, so that both objects don't leak. Bug 198517, r=sgehani, sr=brendan.

git-svn-id: svn://10.0.0.236/trunk@139916 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%netscape.com 2003-03-21 07:04:33 +00:00
parent 81130e7005
commit aa9c46d310

View File

@ -1,4 +1,5 @@
/* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -87,6 +88,10 @@ var nsUpdateNotifier =
classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
observerService.removeObserver(this, "domwindowopened");
// but we are interested in removing our timer reference on XPCOM
// shutdown so as not to leak.
observerService.addObserver(this, "xpcom-shutdown", false);
}
catch (ex)
{
@ -98,6 +103,14 @@ var nsUpdateNotifier =
this.mTimer = null; // free up timer so it can be gc'ed
this.checkForUpdate();
}
else if (aTopic == "xpcom-shutdown")
{
/*
* We need to drop our timer reference here to avoid a leak
* since the timer keeps a reference to the observer.
*/
this.mTimer = null;
}
},
checkForUpdate: function()