account-overview: Ref list models

GTK4's filters models swallow the reference.

Without this calls crashes like this:

```
    #0  g_type_check_instance (type_instance=type_instance@entry=0x555c0f84ce90) at ../../../gobject/gtype.c:4024
    #1  0x00007f0837af6e18 in g_signal_handlers_disconnect_matched
        (instance=0x555c0f84ce90, mask=mask@entry=(G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), signal_id=signal_id@entry=0, detail=detail@entry=0, closure=closure@entry=0x0, func=func@entry=0x7f0836f828a0 <gtk_filter_list_model_items_changed_cb>, data=0x555c0f84f1b0) at ../../../gobject/gsignal.c:3007
    #2  0x00007f0836f82459 in gtk_filter_list_model_clear_model (self=self@entry=0x555c0f84f1b0 [GtkFilterListModel]) at ../../../gtk/gtkfilterlistmodel.c:497
    #3  0x00007f0836f824f4 in gtk_filter_list_model_clear_model (self=0x555c0f84f1b0 [GtkFilterListModel]) at ../../../gtk/gtkfilterlistmodel.c:493
    #4  gtk_filter_list_model_dispose (object=0x555c0f84f1b0 [GtkFilterListModel]) at ../../../gtk/gtkfilterlistmodel.c:661
    #5  0x00007f0837ae1289 in g_object_unref (_object=0x555c0f84f1b0) at ../../../gobject/gobject.c:4438
    #6  0x00007f08379b47f3 in g_hash_table_remove_all_nodes (hash_table=hash_table@entry=0x555c0f84d2c0, notify=notify@entry=1, destruction=destruction@entry=1)
        at ../../../glib/ghash.c:656
    #7  0x00007f08379b53a3 in g_hash_table_remove_all_nodes (hash_table=0x555c0f84d2c0, notify=1, destruction=1) at ../../../glib/ghash.c:578
    #8  g_hash_table_unref (hash_table=0x555c0f84d2c0) at ../../../glib/ghash.c:1438
    #9  g_hash_table_unref (hash_table=0x555c0f84d2c0) at ../../../glib/ghash.c:1432
    #10 0x0000555bf0b649b2 in calls_manager_finalize (object=0x555c0f84b800 [CallsManager]) at ../src/calls-manager.c:465
    #11 0x00007f0837ae14fe in g_object_unref (_object=0x555c0f84b800) at ../../../gobject/gobject.c:4509
    #12 0x0000555bf0b5b92d in finalize (object=0x555c0f82fcb0 [CallsApplication]) at ../src/calls-application.c:780
    #13 0x00007f0837ae14fe in g_object_unref (_object=0x555c0f82fcb0) at ../../../gobject/gobject.c:4509
    #14 0x0000555bf0b58cd4 in main (argc=1, argv=0x7fffc05d57a8) at ../src/main.c:47
```

Steps to reproduce:

- start calls
- open account dialog
- close account dialog
- hit control-c to end calls daemon
- observe above crash

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/777>
This commit is contained in:
Guido Günther
2025-05-04 10:39:15 +02:00
committed by Marge Bot
parent d0b52dddcb
commit a7caa59fba

View File

@@ -401,7 +401,7 @@ calls_account_overview_init (CallsAccountOverview *self)
account_provider_filter = GTK_FILTER (gtk_custom_filter_new (match_account_provider, NULL, NULL));
self->providers =
G_LIST_MODEL (gtk_filter_list_model_new (all_providers, account_provider_filter));
G_LIST_MODEL (gtk_filter_list_model_new (g_object_ref (all_providers), account_provider_filter));
g_signal_connect (self->providers,
"items-changed",
@@ -413,7 +413,7 @@ calls_account_overview_init (CallsAccountOverview *self)
account_filter = GTK_FILTER (gtk_custom_filter_new (match_account, NULL, NULL));
self->accounts =
G_LIST_MODEL (gtk_filter_list_model_new (all_origins, account_filter));
G_LIST_MODEL (gtk_filter_list_model_new (g_object_ref (all_origins), account_filter));
g_signal_connect_object (self->accounts,
"items-changed",
G_CALLBACK (on_accounts_changed),