Open koppor opened 2 years ago
I think the exception was introduced in https://github.com/JabRef/jabref/pull/8973/commits/96c7ea81725f0d739c5ea7d0330c738c634a4121. Because in that commit dialogEdits.addEdit(setFieldEdit)
will be called even when setFieldEdit.end()
was not called. The same thing for the clear and append edits.
Snippet from
AutomaticFieldEditorDialog.java
listening for editsEasyBind.listen(stateManager.lastAutomaticFieldEditorEditProperty(), (obs, old, lastEdit) -> { viewModel.getDialogEdits().addEdit(lastEdit.getEdit()); notificationPanes.get(lastEdit.getTabIndex()) .notify(lastEdit.getAffectedEntries(), selectedEntries.size()); });
Snippet from
EditFieldContentViewModel
sending notification even whensetFieldEdit.end()
is not calledif (setFieldEdit.hasEdits()) { setFieldEdit.end(); } stateManager.setLastAutomaticFieldEditorEdit(new LastAutomaticFieldEditorEdit( affectedEntriesCount, TAB_INDEX, setFieldEdit ));
EDIT It can be fixed by not registering in progress edits
EasyBind.listen(stateManager.lastAutomaticFieldEditorEditProperty(), (obs, old, lastEdit) -> {
if (lastEdit.getEdit().hasEdits()) {
viewModel.getDialogEdits().addEdit(lastEdit.getEdit());
}
notificationPanes.get(lastEdit.getTabIndex())
.notify(lastEdit.getAffectedEntries(), selectedEntries.size());
});
Follow-up to https://github.com/JabRef/jabref/issues/8971