From d374f9c1ce7c6ac8c545d5c058c8997624c7cdfd Mon Sep 17 00:00:00 2001 From: Colin Coleman Date: Sat, 20 Jun 2026 17:04:53 +0200 Subject: [PATCH 1/2] Fix crash clearing filter list when filter graph is disabled filter_selected() and filter_graph_toggled() call gtk_image_clear() on priv->image whenever the selection is cleared or the graph is toggled off. But priv->image is only created when HAVE_FILTERGRAPH is enabled; in builds without it the pointer is NULL, so gtk_image_clear(NULL) dereferences a NULL pointer and crashes. This is reachable in a normal build by removing the last filter from the chain (which clears the selection). Guard both calls with a NULL check. Co-Authored-By: Claude Opus 4.8 --- src/filter_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/filter_interface.c b/src/filter_interface.c index 0896f26..b9e7e3c 100644 --- a/src/filter_interface.c +++ b/src/filter_interface.c @@ -421,7 +421,8 @@ static void filter_graph_toggled(GtkToggleButton *button, FilterDialogPrivate* p filter_graph_update(priv, filter_selection_to_row(priv)); } else { priv->graph_updated = true; - gtk_image_clear(priv->image); + if (priv->image) + gtk_image_clear(priv->image); } } @@ -997,7 +998,8 @@ static void filter_selected(GtkTreeSelection* selection, FilterDialogPrivate* pr priv->selection = NULL; gtk_widget_set_sensitive(priv->editframe, FALSE); if (!priv->fullchain) { - gtk_image_clear(priv->image); + if (priv->image) + gtk_image_clear(priv->image); priv->graph_updated = true; } priv->edit_updated = false; From c15d05db33eba149e89a8921a0ed32bd3e24ab2f Mon Sep 17 00:00:00 2001 From: Colin Coleman Date: Mon, 22 Jun 2026 17:04:40 +0200 Subject: [PATCH 2/2] Guard filter-graph clearing at compile time Per review: priv->image is only allocated when the filter graph is compiled in, so guard the gtk_image_clear() in filter_selected() with #if HAVE_FILTERGRAPH instead of a runtime NULL check. Revert the filter_graph_toggled() change, since that handler is only connected when the graph is enabled and so never runs with a NULL image. Co-Authored-By: Claude Opus 4.8 --- src/filter_interface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/filter_interface.c b/src/filter_interface.c index b9e7e3c..675ef54 100644 --- a/src/filter_interface.c +++ b/src/filter_interface.c @@ -421,8 +421,7 @@ static void filter_graph_toggled(GtkToggleButton *button, FilterDialogPrivate* p filter_graph_update(priv, filter_selection_to_row(priv)); } else { priv->graph_updated = true; - if (priv->image) - gtk_image_clear(priv->image); + gtk_image_clear(priv->image); } } @@ -997,11 +996,12 @@ static void filter_selected(GtkTreeSelection* selection, FilterDialogPrivate* pr gtk_tree_path_free(priv->selection); priv->selection = NULL; gtk_widget_set_sensitive(priv->editframe, FALSE); +#if HAVE_FILTERGRAPH if (!priv->fullchain) { - if (priv->image) - gtk_image_clear(priv->image); + gtk_image_clear(priv->image); priv->graph_updated = true; } +#endif priv->edit_updated = false; }