mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-14 19:55:12 +01:00
gliststore: Simplify a GType check on construction
When setting the GListStore:item-type property we need to check the GType is a GObject (or subclass). There was some explicit code for this, but when actually testing it and looking at the code coverage, it turns out that the GObject property type check coming from g_param_spec_gtype() does everything we want, and the custom g_critical() can never be hit. So turn it into an assertion. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
dfa2a4ae75
commit
35d1ef678a
@ -125,10 +125,8 @@ g_list_store_set_property (GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ITEM_TYPE: /* construct-only */
|
||||
g_assert (g_type_is_a (g_value_get_gtype (value), G_TYPE_OBJECT));
|
||||
store->item_type = g_value_get_gtype (value);
|
||||
if (!g_type_is_a (store->item_type, G_TYPE_OBJECT))
|
||||
g_critical ("GListStore cannot store items of type '%s'. Items must be GObjects.",
|
||||
g_type_name (store->item_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user