Stop observing idle after the database is closed permanently

A permanently closed connection kept its idle observer, so it went on
being notified and attempting backups for the life of the process. This
affects plugin databases, which are closed permanently when the plugin
shuts down.
This commit is contained in:
Dan Stillman 2026-08-21 16:06:36 -04:00
parent 7243648ed7
commit 9e45191b22

View file

@ -1232,6 +1232,13 @@ Zotero.DBConnection.prototype.closeDatabase = async function (permanent) {
this._connection = permanent ? false : null;
Zotero.debug("Database closed");
}
if (permanent && this._idleObserverRegistered) {
this._idleObserverRegistered = false;
Components.classes["@mozilla.org/widget/useridleservice;1"]
.getService(Components.interfaces.nsIUserIdleService)
.removeIdleObserver(this, this.IDLE_OBSERVER_SECONDS);
}
};