jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Library tab unable to close after unsave action

Open LIM0000 opened this issue 3 years ago • 6 comments

JabRef version

5.6 (latest release)

Operating system

Windows

Details on version and operating system

No response

Checked with the latest development build

  • [X] I made a backup of my libraries before testing the latest development version.
  • [X] I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

  1. Click on "New library" button.
  2. Click on "+" button to add new article.
  3. Click on "X" beside tab to close tab.
  4. Click on "Return to JabRef" or "X" button to close Save before closing dialog.
  5. Click on "X" beside tab again to close tab.
  6. User unable to select or close the tab.

https://user-images.githubusercontent.com/49628911/167342107-33fcf7f1-d223-459a-98bb-2993466ede64.mp4

Appendix

...

Log File
Paste an excerpt of your log file here

LIM0000 avatar May 09 '22 04:05 LIM0000

Mentioned in PR #8297 when I am working on #8296 and #8096. Failed to fix this issue but found the root of this issue.

Issue happens here:

event.consume() only able to trigger once if dialogService is executed in closeTab()

libraryTab.setOnCloseRequest(event -> {
            closeTab(libraryTab);
            libraryTab.getDataLoadingTask().cancel();
            event.consume();
        });
Optional<ButtonType> response = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.CONFIRMATION,
                Localization.lang("Save before closing"),
                Localization.lang("Library '%0' has changed.", filename),
                saveChanges, discardChanges, cancel);

More testing:

I have found that showAndWait() is causing event.consume() to only run once.

bug_1 1

LIM0000 avatar May 09 '22 04:05 LIM0000

To clarify: This issue was mentioned in pr #8297, but this can also be reproduced in current JabRef stable 5.6.

ThiloteE avatar May 09 '22 10:05 ThiloteE

It appears to be a known JavaFX issue involving Alert dialogs; it was reported in OpenJFX 11 and ~~fixed~~ targeted to OpenJFX 19 - Alert disables Tab selection when TabDragPolicy REORDER is used

Note

  • I changed the drag policy in TabPane to TabPane.TabDragPolicy.FIXED and the issue is gone.
  • I updated JavaFX version to 19-ea+6 but the problem persists.
  • I tried this workaround but it doesn't work.

HoussemNasri avatar May 09 '22 16:05 HoussemNasri

@HoussemNasri Thanks for the hint, it is targeted for javafx19, but there is not, yet, any PR linked to it :( So we have to wait until it gets fixed

Siedlerchr avatar May 09 '22 17:05 Siedlerchr

it is targeted for javafx19, but there is not, yet, any PR linked to it

Thank you for the clarification, this explains why updating to version 19-ea+6 didn't fix it.

HoussemNasri avatar May 09 '22 18:05 HoussemNasri

The bug still present in JavaFX 19 release version. It is targeted to be fixed in version 20. A pull request has already been submitted to address it: https://github.com/openjdk/jfx/pull/895

HoussemNasri avatar Sep 14 '22 10:09 HoussemNasri

Thank you for reporting this issue. We think, that is already fixed in our development version and consequently the change will be included in the next release.

We would like to ask you to use a development build from https://builds.jabref.org/main and report back if it works for you. Please remember to make a backup of your library before trying-out this version.

Siedlerchr avatar Mar 26 '23 20:03 Siedlerchr