mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-03 17:48:56 +01:00
gtype: make these cases fatal.
Otherwise we crash with a null-ptr deref in g_object_newv and ever there we should not return null, as we're saying that object creation will not return null.
This commit is contained in:
@@ -1854,16 +1854,14 @@ g_type_create_instance (GType type)
|
|||||||
node = lookup_type_node_I (type);
|
node = lookup_type_node_I (type);
|
||||||
if (!node || !node->is_instantiatable)
|
if (!node || !node->is_instantiatable)
|
||||||
{
|
{
|
||||||
g_warning ("cannot create new instance of invalid (non-instantiatable) type `%s'",
|
g_error ("cannot create new instance of invalid (non-instantiatable) type `%s'",
|
||||||
type_descriptive_name_I (type));
|
type_descriptive_name_I (type));
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
/* G_TYPE_IS_ABSTRACT() is an external call: _U */
|
/* G_TYPE_IS_ABSTRACT() is an external call: _U */
|
||||||
if (!node->mutatable_check_cache && G_TYPE_IS_ABSTRACT (type))
|
if (!node->mutatable_check_cache && G_TYPE_IS_ABSTRACT (type))
|
||||||
{
|
{
|
||||||
g_warning ("cannot create instance of abstract (non-instantiatable) type `%s'",
|
g_error ("cannot create instance of abstract (non-instantiatable) type `%s'",
|
||||||
type_descriptive_name_I (type));
|
type_descriptive_name_I (type));
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class = g_type_class_ref (type);
|
class = g_type_class_ref (type);
|
||||||
|
|||||||
Reference in New Issue
Block a user