Hopefully fix intermittently broken items pane
https://forums.zotero.org/discussion/69226/papers-become-invisible-in-the-middle-pane I can't reproduce this, but it seems like if the tree disappears (due to a collection change?) while the tree is refreshing, the toggleSelect() in the rememberSelection() call can fail and break the tree.
This commit is contained in:
parent
fa33eb72b2
commit
7cd1439928
|
@ -2103,8 +2103,13 @@ Zotero.ItemTreeView.prototype.rememberSelection = function (selection) {
|
||||||
var unsuppress = this.selection.selectEventsSuppressed = true;
|
var unsuppress = this.selection.selectEventsSuppressed = true;
|
||||||
this._treebox.beginUpdateBatch();
|
this._treebox.beginUpdateBatch();
|
||||||
}
|
}
|
||||||
for(var i=0; i < selection.length; i++)
|
|
||||||
{
|
// Use try/catch to work around NS_ERROR_UNEXPECTED from nsITreeSelection::toggleSelect(),
|
||||||
|
// apparently when the tree disappears before it's called (though I can't reproduce it):
|
||||||
|
//
|
||||||
|
// https://forums.zotero.org/discussion/69226/papers-become-invisible-in-the-middle-pane
|
||||||
|
try {
|
||||||
|
for (let i = 0; i < selection.length; i++) {
|
||||||
if (this._rowMap[selection[i]] != null) {
|
if (this._rowMap[selection[i]] != null) {
|
||||||
this.selection.toggleSelect(this._rowMap[selection[i]]);
|
this.selection.toggleSelect(this._rowMap[selection[i]]);
|
||||||
}
|
}
|
||||||
|
@ -2127,6 +2132,11 @@ Zotero.ItemTreeView.prototype.rememberSelection = function (selection) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
Zotero.logError(e);
|
||||||
|
}
|
||||||
|
|
||||||
if (unsuppress) {
|
if (unsuppress) {
|
||||||
this._treebox.endUpdateBatch();
|
this._treebox.endUpdateBatch();
|
||||||
this.selection.selectEventsSuppressed = false;
|
this.selection.selectEventsSuppressed = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user