mirror of
https://github.com/zotero/zotero.git
synced 2026-10-04 02:31:47 +00:00
Quick Copy: Don't leak pref observers when uninitialized
This commit is contained in:
parent
6131da92c4
commit
77420760b0
1 changed files with 9 additions and 8 deletions
|
|
@ -43,13 +43,14 @@ Zotero.QuickCopy = new function () {
|
|||
_initialized = true;
|
||||
|
||||
// Make sure export translator code is loaded whenever the output format changes
|
||||
this._prefObserverID = Zotero.Prefs.registerObserver(
|
||||
"export.quickCopy.setting", _loadOutputFormat
|
||||
);
|
||||
|
||||
this._prefObserverID = Zotero.Prefs.registerObserver(
|
||||
"export.noteQuickCopy.setting", _loadNoteOutputFormat
|
||||
);
|
||||
this._prefObserverIDs = [
|
||||
Zotero.Prefs.registerObserver(
|
||||
"export.quickCopy.setting", _loadOutputFormat
|
||||
),
|
||||
Zotero.Prefs.registerObserver(
|
||||
"export.noteQuickCopy.setting", _loadNoteOutputFormat
|
||||
),
|
||||
];
|
||||
|
||||
Zotero.Schema.schemaUpdatePromise.then(async () => {
|
||||
// Avoid random translator initialization during tests, which can result in timeouts
|
||||
|
|
@ -70,7 +71,7 @@ Zotero.QuickCopy = new function () {
|
|||
this.uninit = function () {
|
||||
_initialized = false;
|
||||
_initCancelled = true;
|
||||
Zotero.Prefs.unregisterObserver(this._prefObserverID);
|
||||
this._prefObserverIDs.forEach(id => Zotero.Prefs.unregisterObserver(id));
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue