From 20dced6a4831f24a85046e452ce6271c439ad85d Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 25 Sep 2019 22:28:31 +0200 Subject: [PATCH 1/3] Fix exception when closing JabRef Fixes #5348 by using JavaFX windows instead of awt windows. --- CHANGELOG.md | 3 ++- src/main/java/org/jabref/gui/JabRefFrame.java | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc6c487680a..6bb4d4a4de0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,12 +20,13 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Inherit fields from cross-referenced entries as specified by biblatex. [#5045](https://github.com/JabRef/jabref/issues/5045) - We fixed an issue where it was no longer possible to connect to LibreOffice. [#5261](https://github.com/JabRef/jabref/issues/5261) - The "All entries group" is no longer shown when no library is open. +- We fixed an exception which occurred when closing JabRef. [#5348](https://github.com/JabRef/jabref/issues/5348) - After assigning an entry to a group, the item count is now properly colored to reflect the new membership of the entry. [#3112](https://github.com/JabRef/jabref/issues/3112) - The group panel is now properly updated when switching between libraries (or when closing/opening one). [#3142](https://github.com/JabRef/jabref/issues/3142) - We fixed an error where the number of matched entries shown in the group pane was not updated correctly. [#4441](https://github.com/JabRef/jabref/issues/4441) - We fixed an error mentioning "javafx.controls/com.sun.javafx.scene.control" that was thrown when interacting with the toolbar. - We fixed an error where a cleared search was restored after switching libraries. [#4846](https://github.com/JabRef/jabref/issues/4846) -- We fixed an exception which occured when trying to open a non existing file from the "Recent files"-menu [#5334](https://github.com/JabRef/jabref/issues/5334) +- We fixed an exception which occurred when trying to open a non existing file from the "Recent files"-menu [#5334](https://github.com/JabRef/jabref/issues/5334) ### Removed diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 0eb5e21d30c..ef2eab0c9b7 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -1,6 +1,5 @@ package org.jabref.gui; -import java.awt.Window; import java.io.File; import java.io.IOException; import java.nio.file.Path; @@ -42,6 +41,7 @@ import javafx.scene.layout.Pane; import javafx.scene.layout.Priority; import javafx.stage.Stage; +import javafx.stage.Window; import org.jabref.Globals; import org.jabref.JabRefExecutorService; @@ -367,11 +367,9 @@ private void tearDownJabRef(List filenames) { fileHistory.storeHistory(); prefs.flush(); - // dispose all windows, even if they are not displayed anymore - // TODO: javafx variant only avaiable in java 9 and updwards - // https://docs.oracle.com/javase/9/docs/api/javafx/stage/Window.html#getWindows-- + // Close all open windows for (Window window : Window.getWindows()) { - window.dispose(); + window.hide(); } } From 977c3e9d16086ace04bc06eaf474338676c281e4 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 25 Sep 2019 22:37:29 +0200 Subject: [PATCH 2/3] In fact, just do nothing We cannot iterate over the windows as the might be gone already (when the event is called from closing a window). --- src/main/java/org/jabref/gui/JabRefFrame.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index ef2eab0c9b7..42063139533 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -366,11 +366,6 @@ private void tearDownJabRef(List filenames) { fileHistory.storeHistory(); prefs.flush(); - - // Close all open windows - for (Window window : Window.getWindows()) { - window.hide(); - } } /** From e55357263ea4f5a6f28b2015573dab71a127cf1c Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 25 Sep 2019 22:37:47 +0200 Subject: [PATCH 3/3] Update JabRefFrame.java --- src/main/java/org/jabref/gui/JabRefFrame.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 42063139533..bfac4087805 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -41,7 +41,6 @@ import javafx.scene.layout.Pane; import javafx.scene.layout.Priority; import javafx.stage.Stage; -import javafx.stage.Window; import org.jabref.Globals; import org.jabref.JabRefExecutorService;