commit ca2e1f4de60b6da7135d818194d053cc91e529a7 parent bebd96726428764f78a2d0fa2095a8c5961cf0ad Author: Simon Kornblith <simon@simonster.com> Date: Thu, 23 Jun 2011 09:42:50 +0000 Fix decrementing async processes when there is more than one level of translator calls Diffstat:
| M | chrome/content/zotero/xpcom/translation/translate.js | | | 9 | ++++----- |
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -685,8 +685,8 @@ Zotero.Translate.Base.prototype = { /** * Indicates that a new async process is finished */ - "decrementAsyncProcesses":function() { - this._runningAsyncProcesses--; + "decrementAsyncProcesses":function(by) { + this._runningAsyncProcesses -= (by ? by : 1); Zotero.debug("Translate: Decremented asynchronous processes to "+this._runningAsyncProcesses, 4); if(this._runningAsyncProcesses === 0) { this.complete(); @@ -906,9 +906,8 @@ Zotero.Translate.Base.prototype = { var oldState = this._currentState; // reset async processes and propagate them to parent - if(this._parentTranslator) { - this._parentTranslator._runningAsyncProcesses -= this._runningAsyncProcesses; - if(this._parentTranslator._runningAsyncProcesses === 0) this._parentTranslator.complete(); + if(this._parentTranslator && this._runningAsyncProcesses) { + this._parentTranslator.decrementAsyncProcesses(this._runningAsyncProcesses); } this._runningAsyncProcesses = 0;