Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Autosave threading issue #5967

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Fixed

- We fixed an issue where Autosave actions could lead to an exception. [#5658](https://github.com/JabRef/jabref/issues/5658)

### Removed


Expand Down
32 changes: 17 additions & 15 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1086,25 +1086,27 @@ private List<String> getUniquePathParts() {
}

public void updateAllTabTitles() {
List<String> paths = getUniquePathParts();
for (int i = 0; i < getBasePanelCount(); i++) {
String uniqPath = paths.get(i);
Optional<Path> file = getBasePanelAt(i).getBibDatabaseContext().getDatabasePath();

if (file.isPresent()) {
if (!uniqPath.equals(file.get().getFileName()) && uniqPath.contains(File.separator)) {
// remove filename
uniqPath = uniqPath.substring(0, uniqPath.lastIndexOf(File.separator));
tabbedPane.getTabs().get(i).setText(getBasePanelAt(i).getTabTitle() + " \u2014 " + uniqPath);
DefaultTaskExecutor.runInJavaFXThread(() -> {
List<String> paths = getUniquePathParts();
for (int i = 0; i < getBasePanelCount(); i++) {
String uniqPath = paths.get(i);
Optional<Path> file = getBasePanelAt(i).getBibDatabaseContext().getDatabasePath();

if (file.isPresent()) {
if (!uniqPath.equals(file.get().getFileName()) && uniqPath.contains(File.separator)) {
// remove filename
uniqPath = uniqPath.substring(0, uniqPath.lastIndexOf(File.separator));
tabbedPane.getTabs().get(i).setText(getBasePanelAt(i).getTabTitle() + " \u2014 " + uniqPath);
} else {
// set original filename (again)
tabbedPane.getTabs().get(i).setText(getBasePanelAt(i).getTabTitle());
}
} else {
// set original filename (again)
tabbedPane.getTabs().get(i).setText(getBasePanelAt(i).getTabTitle());
}
} else {
tabbedPane.getTabs().get(i).setText(getBasePanelAt(i).getTabTitle());
tabbedPane.getTabs().get(i).setTooltip(new Tooltip(file.map(Path::toAbsolutePath).map(Path::toString).orElse(null)));
}
tabbedPane.getTabs().get(i).setTooltip(new Tooltip(file.map(Path::toAbsolutePath).map(Path::toString).orElse(null)));
}
});
}

private ContextMenu createTabContextMenu(KeyBindingRepository keyBindingRepository) {
Expand Down