Return a promise from Zotero.shutdown()
This commit is contained in:
parent
8a8093028d
commit
a723c85999
2 changed files with 16 additions and 36 deletions
|
@ -423,7 +423,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
|||
}
|
||||
|
||||
// Register shutdown handler to call Zotero.shutdown()
|
||||
var _shutdownObserver = {observe:function() { Zotero.shutdown() }};
|
||||
var _shutdownObserver = {observe:function() { Zotero.shutdown().done() }};
|
||||
Services.obs.addObserver(_shutdownObserver, "quit-application", false);
|
||||
|
||||
try {
|
||||
|
@ -783,7 +783,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
|||
}
|
||||
|
||||
|
||||
this.shutdown = function(callback) {
|
||||
this.shutdown = function() {
|
||||
Zotero.debug("Shutting down Zotero");
|
||||
|
||||
try {
|
||||
|
@ -811,20 +811,17 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
|||
Components.utils.forceGC();
|
||||
|
||||
// unlock DB
|
||||
Zotero.DB.closeDatabase().then(function() {
|
||||
return Zotero.DB.closeDatabase().then(function() {
|
||||
// broadcast that DB lock has been released
|
||||
Zotero.IPC.broadcast("lockReleased");
|
||||
if(callback) callback();
|
||||
});
|
||||
} else {
|
||||
if(callback) callback();
|
||||
}
|
||||
|
||||
return Q();
|
||||
} catch(e) {
|
||||
Zotero.debug(e);
|
||||
throw e;
|
||||
return Q.reject(e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue