diff --git a/apps/ikonli-browser/src/main/java/org/kordamp/ikonli/browser/SearchInternalWindow.java b/apps/ikonli-browser/src/main/java/org/kordamp/ikonli/browser/SearchInternalWindow.java index aa8bd133f..2f243034e 100644 --- a/apps/ikonli-browser/src/main/java/org/kordamp/ikonli/browser/SearchInternalWindow.java +++ b/apps/ikonli-browser/src/main/java/org/kordamp/ikonli/browser/SearchInternalWindow.java @@ -165,6 +165,13 @@ public void onChanged(Change c) { while (c.next()) { if (c.wasAdded()) { addIcons(new ArrayList<>(c.getAddedSubList()), grid); + } else if (c.wasRemoved()) { + // can only happen when we clear the list + if (Platform.isFxApplicationThread()) { + grid.getChildren().clear(); + } else { + Platform.runLater(() -> grid.getChildren().clear()); + } } } } @@ -324,6 +331,8 @@ public Controller(Model model) { } public void search() { + model.getIkons().clear(); + if (executor == null) { executor = Executors.newSingleThreadExecutor(); }