diff --git a/chrome/content/zotero/xpcom/ipc.js b/chrome/content/zotero/xpcom/ipc.js index bf5ae1d513..3c0d7d3b4b 100755 --- a/chrome/content/zotero/xpcom/ipc.js +++ b/chrome/content/zotero/xpcom/ipc.js @@ -53,6 +53,11 @@ Zotero.IPC = new function() { switchConnectorMode(true); } else if(msg === "lockReleased") { Zotero.onDBLockReleased(); + } else if(msg === "checkInitComplete") { + while(!Zotero.initialized) { + Zotero.mainThread.processNextEvent(true) + } + Zotero.IPC.broadcast("initComplete"); } else if(msg === "initComplete") { Zotero.onInitComplete(); } diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 212c6cb8b3..00d7cc8f80 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -438,10 +438,13 @@ if(appInfo.platformVersion[0] >= 2) { // Wait for initComplete message if we switched to connector because standalone was // started. This shouldn't loop indefinitely, but even if it does, it won't hang // anything (since it will stop looping on shutdown). + Zotero.IPC.broadcast("checkInitComplete"); + Zotero.debug("Waiting for initComplete message"); _waitingForInitComplete = true; while(_waitingForInitComplete && !Zotero.closing) { Zotero.mainThread.processNextEvent(true); } + Zotero.debug("initComplete message received"); if(Zotero.closing) return false; } @@ -461,9 +464,6 @@ if(appInfo.platformVersion[0] >= 2) { observerService.notifyObservers(Zotero, "zotero-reloaded", null); } - // Broadcast initComplete message if desired - if(_broadcastInitComplete) Zotero.IPC.broadcast("initComplete"); - return true; } @@ -696,9 +696,6 @@ if(appInfo.platformVersion[0] >= 2) { } if(Zotero.closing) return false; - // We will want to broadcast when initialization completes - _broadcastInitComplete = true; - // Run a second init with haveReleasedLock = true, so that // if we still can't acquire a DB lock, we will give up return _initDB(true);