From be85a184e2a8a790611cbf482cc28920369d9c4e Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 6 Nov 2024 12:10:35 +0000 Subject: [PATCH] Fix threading bug when image type changes Changes to the image type prompt changes in the UI - which need to be on the right thread. --- .../java/qupath/ext/instanseg/ui/InstanSegController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java b/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java index 044586e..5e39c9c 100644 --- a/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java +++ b/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java @@ -1,5 +1,6 @@ package qupath.ext.instanseg.ui; +import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.beans.binding.ObjectBinding; @@ -341,6 +342,10 @@ private void updateInputChannels(ImageData imageData) { if (imageData == null) { return; } + if (!Platform.isFxApplicationThread()) { + Platform.runLater(() -> updateInputChannels(imageData)); + return; + } // Store the checks without changing the current value inputChannelCache.snapshotChecks(); // Update the items