commit 506b35840ed6c3d165394cafb4e9951b8af0dc6d
parent aa6037c088958387e8090b259989d940f3f04f63
Author: Tom Najdek <tom@doppnet.com>
Date: Wed, 31 May 2017 16:36:10 +0100
Add a shutdown hook in Zotero.Prefs to unregister observer
* Without this, preference change observers stack, triggering multiple
times if Zotero is re-initialized multiple times within the same
browser instance (like in tests)
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1938,7 +1938,12 @@ Zotero.Prefs = new function(){
// Register observer to handle pref changes
this.register();
-
+
+ // Unregister observer handling pref changes
+ if (Zotero.addShutdownListener) {
+ Zotero.addShutdownListener(this.unregister.bind(this));
+ }
+
// Process pref version updates
var fromVersion = this.get('prefVersion');
if (!fromVersion) {