Additional try/catch to fix NS_ERROR_UNEXPECTED from tree select
Follow-up to 7cd1439928
This commit is contained in:
parent
2bc44dddd1
commit
374eefada1
|
@ -1869,6 +1869,7 @@ Zotero.ItemTreeView.prototype.selectItem = Zotero.Promise.coroutine(function* (i
|
||||||
// refreshed. To get around this, we wait for a select event that's triggered by
|
// refreshed. To get around this, we wait for a select event that's triggered by
|
||||||
// itemSelected() when it's done.
|
// itemSelected() when it's done.
|
||||||
let promise;
|
let promise;
|
||||||
|
try {
|
||||||
if (this.selection.selectEventsSuppressed) {
|
if (this.selection.selectEventsSuppressed) {
|
||||||
this.selection.select(row);
|
this.selection.select(row);
|
||||||
}
|
}
|
||||||
|
@ -1882,6 +1883,14 @@ Zotero.ItemTreeView.prototype.selectItem = Zotero.Promise.coroutine(function* (i
|
||||||
this.toggleOpenState(row);
|
this.toggleOpenState(row);
|
||||||
}
|
}
|
||||||
this.selection.select(row);
|
this.selection.select(row);
|
||||||
|
}
|
||||||
|
// Ignore NS_ERROR_UNEXPECTED from nsITreeSelection::select(), apparently when the tree
|
||||||
|
// disappears before it's called (though I can't reproduce it):
|
||||||
|
//
|
||||||
|
// https://forums.zotero.org/discussion/comment/297039/#Comment_297039
|
||||||
|
catch (e) {
|
||||||
|
Zotero.logError(e);
|
||||||
|
}
|
||||||
|
|
||||||
if (promise) {
|
if (promise) {
|
||||||
yield promise;
|
yield promise;
|
||||||
|
@ -2104,10 +2113,6 @@ Zotero.ItemTreeView.prototype.rememberSelection = function (selection) {
|
||||||
this._treebox.beginUpdateBatch();
|
this._treebox.beginUpdateBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
try {
|
||||||
for (let i = 0; i < selection.length; i++) {
|
for (let i = 0; i < selection.length; i++) {
|
||||||
if (this._rowMap[selection[i]] != null) {
|
if (this._rowMap[selection[i]] != null) {
|
||||||
|
@ -2133,6 +2138,10 @@ Zotero.ItemTreeView.prototype.rememberSelection = function (selection) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Ignore 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
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.logError(e);
|
Zotero.logError(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user