From: Matthias Clasen Date: Sat, 27 May 2023 21:26:39 +0000 (-0400) Subject: sortlistmodel: Fix handling of section sort keys X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~210^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9f47bfe193b326abf3c2046274dba7e6e27da824;p=gtk4.git sortlistmodel: Fix handling of section sort keys When the section sorter changes, we need to update the keys, otherwise the sorter will continue to report the old sections. This code is currently a bit suboptimal, since the creation of sort keys and section sort keys are muddled together. Fixes: #5854 --- diff --git a/gtk/gtksortlistmodel.c b/gtk/gtksortlistmodel.c index 50add242f0..becfec012e 100644 --- a/gtk/gtksortlistmodel.c +++ b/gtk/gtksortlistmodel.c @@ -912,6 +912,12 @@ gtk_sort_list_model_sorter_changed_cb (GtkSorter *sorter, } } + if (self->section_sorter) + { + gtk_sort_keys_unref (self->section_sort_keys); + self->section_sort_keys = gtk_sorter_get_keys (self->section_sorter); + } + if (gtk_sort_list_model_start_sorting (self, NULL)) pos = n_items = 0; else