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 "Changing owner name crashes the application" #10932

Merged
merged 3 commits into from
Feb 28, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this property is both in the owner preferences and the internal prefs. This looks like it should be only in one place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});
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
Loading