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 closing of library not handling backup and autosave manager shutdown #4794

Merged
merged 3 commits into from
Mar 26, 2019
Merged
Changes from 1 commit
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 src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,7 @@ public void addTab(BasePanel basePanel, boolean raisePanel) {
// add tab
Tab newTab = new Tab(basePanel.getTabTitle(), basePanel);
tabbedPane.getTabs().add(newTab);
newTab.setOnCloseRequest(event -> closeTab((BasePanel) newTab.getContent()));
Copy link
Member

Choose a reason for hiding this comment

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

That's a very good observation.

As of now the user can close the tab even if there are unsaved changes. Thus, we should improve the functionality here a bit by calling confirmClose and consuming the event in case the user canceled the close operation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The method closeTab() makes a call to confirmClose when the panel is modified. However, it does not consume the event in case of cancelling. Since, the logic for removing tab is already handled I think it should be enough to consume the event in the closeRequest Itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The confirmClose shows a dialog with 3 option Save changes, Discard changes and Return to JabRef. The confirmClose method returns false only if the user clicks Return to JabRef in this case, the tab isn't closed however the autosave and backup managers are shutdown any way.
I don't think they should be shutdown in this case, we can return from closeTab() in case confirmClose returns false.


// update all tab titles
updateAllTabTitles();
Expand Down