widgets: Prevent crash when changing indexed color

Similar logic to 4d8073a3 - the selection signal was not
being properly disconnected when the dialogue closed after
the color entry's color was changed via the HTML field.
This patch switches to using g_signal_connect_object ()
to automatically disconnect when the object is destroyed.
This commit is contained in:
Alx Sa 2025-05-24 17:47:34 +00:00
parent 3edafcc7bc
commit 5918e2b4d3

View file

@ -836,9 +836,9 @@ gimp_colormap_selection_set_palette (GimpColormapSelection *selection)
gint n_colors;
n_colors = gimp_palette_get_n_colors (palette);
g_signal_connect_swapped (palette, "dirty",
G_CALLBACK (gtk_widget_queue_draw),
selection);
g_signal_connect_object (palette, "dirty",
G_CALLBACK (gtk_widget_queue_draw),
selection, G_CONNECT_SWAPPED);
gimp_view_set_viewable (GIMP_VIEW (selection->view),
GIMP_VIEWABLE (palette));
gtk_adjustment_set_upper (selection->index_adjustment, n_colors - 1);