From 222870d3c7d99fc67273d804809697497d973853 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 2 Dec 2019 04:27:01 -0700 Subject: [PATCH] Don't update item type menus within transaction when updating schema This caused an error reported here, though I can't reproduce it: https://forums.zotero.org/discussion/80287/zotero-database-upgrade-error --- chrome/content/zotero/xpcom/schema.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 2a25b0f1c2..3b4143e287 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -775,14 +775,15 @@ Zotero.Schema = new function(){ yield Zotero.SearchConditions.init(); // Update item type menus in every open window - var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] - .getService(Components.interfaces.nsIWindowMediator); - var enumerator = wm.getEnumerator("navigator:browser"); - while (enumerator.hasMoreElements()) { - var win = enumerator.getNext(); - win.ZoteroPane.buildItemTypeSubMenu(); - win.document.getElementById('zotero-editpane-item-box').buildItemTypeMenu(); - } + Zotero.Schema.schemaUpdatePromise.then(function () { + var wm = Services.wm; + var enumerator = wm.getEnumerator("navigator:browser"); + while (enumerator.hasMoreElements()) { + let win = enumerator.getNext(); + win.ZoteroPane.buildItemTypeSubMenu(); + win.document.getElementById('zotero-editpane-item-box').buildItemTypeMenu(); + } + }); });