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)
This commit is contained in:
parent
aa6037c088
commit
506b35840e
1 changed files with 6 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue