mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 750454 - Fix FUEL leaks. Part 1: Use weak refs in Application. r=mak
--HG-- extra : rebase_source : 04b4ce7ee1488481281a3073b4ba6900f14afbdf
This commit is contained in:
parent
92795586bd
commit
28943a197c
@ -646,7 +646,7 @@ Application.prototype = {
|
||||
|
||||
// for nsISupports
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.fuelIApplication, Ci.extIApplication,
|
||||
Ci.nsIObserver]),
|
||||
Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
// for nsIClassInfo
|
||||
classInfo: XPCOMUtils.generateCI({classID: APPLICATION_CID,
|
||||
|
@ -512,13 +512,9 @@ extApplication.prototype = {
|
||||
"@mozilla.org/xre/app-info;1",
|
||||
"nsIXULAppInfo");
|
||||
|
||||
// While the other event listeners are loaded only if needed,
|
||||
// FUEL *must* listen for shutdown in order to clean up it's
|
||||
// references to various services, and to remove itself as
|
||||
// observer of any other notifications.
|
||||
this._obs = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
this._obs.addObserver(this, "xpcom-shutdown", false);
|
||||
this._obs.addObserver(this, "xpcom-shutdown", /* ownsWeak = */ true);
|
||||
this._registered = {"unload": true};
|
||||
},
|
||||
|
||||
@ -561,12 +557,6 @@ extApplication.prototype = {
|
||||
gShutdown[i]();
|
||||
}
|
||||
gShutdown.splice(0, gShutdown.length);
|
||||
|
||||
// release our observers
|
||||
this._obs.removeObserver(this, "app-startup");
|
||||
this._obs.removeObserver(this, "final-ui-startup");
|
||||
this._obs.removeObserver(this, "quit-application-requested");
|
||||
this._obs.removeObserver(this, "xpcom-shutdown");
|
||||
}
|
||||
},
|
||||
|
||||
@ -607,7 +597,7 @@ extApplication.prototype = {
|
||||
if (!(aEvent in rmap) || aEvent in self._registered)
|
||||
return;
|
||||
|
||||
self._obs.addObserver(self, rmap[aEvent]);
|
||||
self._obs.addObserver(self, rmap[aEvent], /* ownsWeak = */ true);
|
||||
self._registered[aEvent] = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user