Skip to content

Commit

Permalink
Don't start transaction to clear search temp table
Browse files Browse the repository at this point in the history
This might fix loss of item focus when editing a note in a search,
possibly starting with fbf2fbe.
  • Loading branch information
dstillman committed Nov 28, 2017
1 parent da38787 commit a70a517
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions chrome/content/zotero/xpcom/collectionTreeView.js
Expand Up @@ -2359,11 +2359,12 @@ Zotero.CollectionTreeCache = {
"clear": function () {
this.lastTreeRow = null;
this.lastSearch = null;
if(this.lastTempTable) {
// Drop the last temp table when we can. We don't wait on this because it can cause a
// deadlock: this waits on open transactions, but a transaction could be waiting on
// ItemTreeView::notify(), which waits on ItemTreeView::refresh(), which calls this.
Zotero.DB.queryTx("DROP TABLE IF EXISTS " + this.lastTempTable).done();
if (this.lastTempTable) {
let tableName = this.lastTempTable;
let id = Zotero.DB.addCallback('commit', async function () {
await Zotero.DB.queryAsync("DROP TABLE IF EXISTS " + tableName);
Zotero.DB.removeCallback('commit', id);
});
}
this.lastTempTable = null;
this.lastResults = null;
Expand Down

0 comments on commit a70a517

Please sign in to comment.