Skip to content

Commit

Permalink
Fix "Changing owner name crashes the application" (JabRef#10932)
Browse files Browse the repository at this point in the history
* Fix propagation of value change

* Add CHANGELOG.md entry

* Fix braces
  • Loading branch information
koppor authored Feb 28, 2024
1 parent 7317c2e commit 16a526f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where the preview panel showing the wrong entry (an entry that is not selected in the entry table). [#9172](https://github.com/JabRef/jabref/issues/9172)
- We fixed an issue where HTML-reserved characters like '&' and '<', in addition to HTML entities like '&amp;' were not rendered correctly in entry preview. [#10677](https://github.com/JabRef/jabref/issues/10677)
- The last page of a PDF is now indexed by the full text search. [#10193](https://github.com/JabRef/jabref/issues/10193)
- The default owner of an entry can be changed again. [#10924](https://github.com/JabRef/jabref/issues/10924)
- We fixed an issue where the duplicate check did not take umlauts or other LaTeX-encoded characters into account. [#10744](https://github.com/JabRef/jabref/pull/10744)
- We fixed the colors of the icon on hover for unset special fields. [#10431](https://github.com/JabRef/jabref/issues/10431)
- We fixed an issue where the CrossRef field did not work if autocompletion was disabled [#8145](https://github.com/JabRef/jabref/issues/8145)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/preferences/FilePreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public String getUserAndHost() {
return userAndHost.getValue();
}

public StringProperty getUserAndHostProperty() {
return userAndHost;
}

public Optional<Path> getMainFileDirectory() {
if (StringUtil.isBlank(mainFileDirectory.getValue())) {
return Optional.empty();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/preferences/InternalPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public String getUserAndHost() {
return userAndHost.get();
}

public StringProperty getUserAndHostProperty() {
return userAndHost;
}

public boolean isMemoryStickMode() {
return memoryStickMode.get();
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -1406,8 +1406,9 @@ public OwnerPreferences getOwnerPreferences() {
put(DEFAULT_OWNER, newValue);
// trigger re-determination of userAndHost and the dependent preferences
userAndHost = null;
filePreferences = null;
internalPreferences = null;

// this propagates down to filePreferences
getInternalPreferences().getUserAndHostProperty().setValue(newValue);
});
EasyBind.listen(ownerPreferences.overwriteOwnerProperty(), (obs, oldValue, newValue) -> putBoolean(OVERWRITE_OWNER, newValue));

Expand Down Expand Up @@ -2205,6 +2206,7 @@ public FilePreferences getFilePreferences() {
getBoolean(CONFIRM_LINKED_FILE_DELETE),
getBoolean(TRASH_INSTEAD_OF_DELETE));

EasyBind.listen(getInternalPreferences().getUserAndHostProperty(), (obs, oldValue, newValue) -> filePreferences.getUserAndHostProperty().setValue(newValue));
EasyBind.listen(filePreferences.mainFileDirectoryProperty(), (obs, oldValue, newValue) -> put(MAIN_FILE_DIRECTORY, newValue));
EasyBind.listen(filePreferences.storeFilesRelativeToBibFileProperty(), (obs, oldValue, newValue) -> putBoolean(STORE_RELATIVE_TO_BIB, newValue));
EasyBind.listen(filePreferences.fileNamePatternProperty(), (obs, oldValue, newValue) -> put(IMPORT_FILENAMEPATTERN, newValue));
Expand Down

0 comments on commit 16a526f

Please sign in to comment.