diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm index 5e83931..4cdee21 100644 --- a/src/modules/FiretrayHandler.jsm +++ b/src/modules/FiretrayHandler.jsm @@ -36,6 +36,8 @@ firetray.Handler = { windowsCount: 0, visibleWindowsCount: 0, observedTopics: {}, + ctypesLibs: {}, // {"lib1": lib1, "lib2": lib2} + appId: (function(){return Services.appinfo.ID;})(), appName: (function(){return Services.appinfo.name;})(), @@ -117,7 +119,7 @@ firetray.Handler = { firetray.Messaging.shutdown(); firetray.StatusIcon.shutdown(); firetray.Window.shutdown(); - // watchout order and sufficiency of lib closings (tryCloseLibs()) + this.tryCloseLibs(); firetray.Utils.removeAllObservers(this); @@ -126,6 +128,24 @@ firetray.Handler = { return true; }, + tryCloseLibs: function() { + try { + for (libName in this.ctypesLibs) { + let lib = this.ctypesLibs[libName]; + if (lib.available()) + lib.close(); + }; + } catch(x) { F.ERROR(x); } + }, + + subscribeLibsForClosing: function(libs) { + for (let i=0, len=libs.length; i