www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 76bc61e8827d43b44c719c6956a16e99d97f8fbe
parent 79a07cad9eee0d2276ed96376635a82eb3e81fa4
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu,  2 Feb 2017 22:34:12 -0500

Don't unload object on save error if not new

Diffstat:
Mchrome/content/zotero/xpcom/data/dataObject.js | 18++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js @@ -909,14 +909,16 @@ Zotero.DataObject.prototype._initSave = Zotero.Promise.coroutine(function* (env) } // Undo registerObject() on failure - var func = function () { - this.ObjectsClass.unload(this._id); - }.bind(this); - if (env.options.tx) { - env.transactionOptions.onRollback = func; - } - else { - Zotero.DB.addCurrentCallback("rollback", func); + if (env.isNew) { + var func = function () { + this.ObjectsClass.unload(this._id); + }.bind(this); + if (env.options.tx) { + env.transactionOptions.onRollback = func; + } + else { + Zotero.DB.addCurrentCallback("rollback", func); + } } env.relationsToRegister = [];