From e5f4cae49094dd8acc8203755cb87841fe7a786b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 7 Oct 2011 07:57:08 -0400 Subject: [PATCH] Fix some cleanup issues with multiple windows. --- common/content/dactyl.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 2939b511..672ceb1a 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -65,6 +65,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }, destroy: function () { + this.observe.unregister(); autocommands.trigger("LeavePre", {}); dactyl.triggerObserver("shutdown", null); util.dump("All dactyl modules destroyed\n"); @@ -98,9 +99,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { this.trapErrors("destroy", mod, reason); } - for (let mod in values(modules.ownPropertyValues.reverse())) - if (mod instanceof Class && "INIT" in mod && "cleanup" in mod.INIT) - this.trapErrors(mod.cleanup, mod, dactyl, modules, window, reason); + modules.moduleManager.initDependencies("cleanup"); for (let name in values(Object.getOwnPropertyNames(modules).reverse())) try { @@ -1129,7 +1128,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { return func.apply(self || this, Array.slice(arguments, 2)); } catch (e) { - dactyl.reportError(e, true); + try { + dactyl.reportError(e, true); + } + catch (e) { + util.reportError(e); + } return e; } },