diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-26 14:20:25 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-26 14:23:16 -0400 |
commit | eb3381723f9854c586df8705386e86075bb6b2a0 (patch) | |
tree | 4826f9e0d0d826fc8ec5dd164c85807fe89d23bc | |
parent | 7e87ad188748039d35bca0ecf3630f51e717f174 (diff) | |
download | gtk+-map-list-constructor.tar.gz |
maplistmodel: Make constructor transfer fullmap-list-constructor
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.
Update all callers.
-rw-r--r-- | gtk/gtkmaplistmodel.c | 5 | ||||
-rw-r--r-- | gtk/inspector/controllers.c | 1 | ||||
-rw-r--r-- | testsuite/gtk/maplistmodel.c | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/gtk/gtkmaplistmodel.c b/gtk/gtkmaplistmodel.c index ea43269c07..9334f0ee40 100644 --- a/gtk/gtkmaplistmodel.c +++ b/gtk/gtkmaplistmodel.c @@ -412,7 +412,7 @@ gtk_map_list_model_augment (GtkRbTree *map, /** * gtk_map_list_model_new: - * @model: (allow-none): The model to map or %NULL for none + * @model: (transfer full) (allow-none): The model to map or %NULL for none * @map_func: (allow-none): map function or %NULL to not map items * @user_data: (closure): user data passed to @map_func * @user_destroy: destroy notifier for @user_data @@ -435,6 +435,9 @@ gtk_map_list_model_new (GListModel *model, "model", model, NULL); + /* consume the reference */ + g_clear_object (&model); + if (map_func) gtk_map_list_model_set_map_func (result, map_func, user_data, user_destroy); diff --git a/gtk/inspector/controllers.c b/gtk/inspector/controllers.c index 5c4bab15b5..9d1ef7ffaf 100644 --- a/gtk/inspector/controllers.c +++ b/gtk/inspector/controllers.c @@ -244,7 +244,6 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self, gtk_property_lookup_list_model_set_object (self->model, object); map_model = gtk_map_list_model_new (G_LIST_MODEL (self->model), map_to_controllers, NULL, NULL); - g_object_unref (self->model); flatten_model = gtk_flatten_list_model_new (G_LIST_MODEL (map_model)); diff --git a/testsuite/gtk/maplistmodel.c b/testsuite/gtk/maplistmodel.c index 94a437f842..975d1d20d6 100644 --- a/testsuite/gtk/maplistmodel.c +++ b/testsuite/gtk/maplistmodel.c @@ -196,7 +196,7 @@ new_model (GListStore *store) GtkMapListModel *result; GString *changes; - result = gtk_map_list_model_new (G_LIST_MODEL (store), map_multiply, GUINT_TO_POINTER (2), NULL); + result = gtk_map_list_model_new (g_object_ref (G_LIST_MODEL (store)), map_multiply, GUINT_TO_POINTER (2), NULL); changes = g_string_new (""); g_object_set_qdata_full (G_OBJECT(result), changes_quark, changes, free_changes); g_signal_connect (result, "items-changed", G_CALLBACK (items_changed), changes); |