mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-02 14:57:11 +01:00
Catch cases of forgotten g_type_add_private(). (#148368, Tommi Komulainen)
2004-07-28 Matthias Clasen <mclasen@redhat.com> * gtype.c (g_type_instance_get_private): Catch cases of forgotten g_type_add_private(). (#148368, Tommi Komulainen)
This commit is contained in:
committed by
Matthias Clasen
parent
889096b1ea
commit
47bd02855f
@@ -3585,6 +3585,12 @@ g_type_instance_get_private (GTypeInstance *instance,
|
||||
parent_node = lookup_type_node_I (NODE_PARENT_TYPE (private_node));
|
||||
g_assert (parent_node->data && parent_node->data->common.ref_count);
|
||||
|
||||
if (G_UNLIKELY (private_node->data->instance.private_size == parent_node->data->instance.private_size))
|
||||
{
|
||||
g_warning ("g_type_get_private() requires a prior call to g_type_add_private()");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
offset += ALIGN_STRUCT (parent_node->data->instance.private_size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user