diff --git a/Core/src/org/sleuthkit/autopsy/core/Installer.java b/Core/src/org/sleuthkit/autopsy/core/Installer.java index 434e8798a5291a5870d1d8ba45dabea9739e8da7..24c40e9967666af66e2915ae1b002cf9dcae469a 100644 --- a/Core/src/org/sleuthkit/autopsy/core/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/core/Installer.java @@ -263,6 +263,13 @@ private static void initJavaFx() { //initialize java fx if exists System.setProperty("javafx.macosx.embedded", "true"); try { + + // Due to a lingering issue https://bugs.openjdk.org/browse/JDK-8223377 where glass.dll from java 8 gets loaded instead of the java 17 one. + String javaLibraryPath = "java.library.path"; + String jvmBinPathStr = Paths.get(System.getProperty("java.home"), "bin").toAbsolutePath().toString(); + String path = System.getProperty(javaLibraryPath); + System.setProperty(javaLibraryPath, StringUtils.isBlank(path) ? jvmBinPathStr : jvmBinPathStr + File.pathSeparator + path); + // Creating a JFXPanel initializes JavaFX new JFXPanel(); Platform.setImplicitExit(false); diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/XMLUtil.java b/Core/src/org/sleuthkit/autopsy/coreutils/XMLUtil.java index 4323753515a89d65e5704846d833befa0bad3b3e..eb3c16e1c19b204c255e2222f958f07042951b92 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/XMLUtil.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/XMLUtil.java @@ -55,6 +55,11 @@ */ public class XMLUtil { + static { + // this is to ensure using xalan for the transformer factory: https://stackoverflow.com/a/64364531/2375948 + System.setProperty("javax.xml.transform.TransformerFactory","com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); + } + private static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { // See JIRA-6958 for details about class loading and jaxb. ClassLoader original = Thread.currentThread().getContextClassLoader(); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java index fed02ac6e40cc82b22a4018f7f4a18f5182d77a5..4a4665e1ffb43a2329c660099ac8e33a1d1df1b3 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java @@ -46,6 +46,7 @@ import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.property.SimpleObjectProperty; +import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.ObservableList; import javafx.event.ActionEvent; @@ -662,24 +663,25 @@ private class DrawableCell extends GridCell<Long> { private final DrawableTile tile = new DrawableTile(GroupPane.this, controller); - DrawableCell() { - itemProperty().addListener((ObservableValue<? extends Long> observable, Long oldValue, Long newValue) -> { - if (oldValue != null) { - cellMap.remove(oldValue, DrawableCell.this); - tile.setFile(null); + protected final ChangeListener<Long> changeListener = (ObservableValue<? extends Long> observable, Long oldValue, Long newValue) -> { + if ((oldValue == null && newValue == null) || (oldValue != null && newValue != null && oldValue.equals(newValue))) { + // if no change, do nothing + return; + } + + DrawableCell oldValueCell = oldValue == null ? null : cellMap.remove(oldValue); + if (oldValueCell != null) { + // remove change listener to get garbage collected + oldValueCell.itemProperty().removeListener(oldValueCell.changeListener); } + if (newValue != null) { - if (cellMap.containsKey(newValue)) { - if (tile != null) { - // Clear out the old value to prevent out-of-date listeners - // from activating. - cellMap.get(newValue).tile.setFile(null); - } - } cellMap.put(newValue, DrawableCell.this); } - }); - + }; + + DrawableCell() { + itemProperty().addListener(changeListener); setGraphic(tile); }