gtype: disallow adding interfaces after the fact

Add a check to prevent adding an interface to a class that has already
had its class_init done.

This is an incompatible change but it is suspected that there are not
many users of this functionality.  Two known exceptions are pygobject
(fixed in bug 686149) and our own testsuite (affected tests have been
temporarily disabled by this patch).

Once we confirm that nobody else is using this functionality we can
remove a rather large amount of code for dealing with this case.

https://bugzilla.gnome.org/show_bug.cgi?id=687659
This commit is contained in:
Ryan Lortie
2012-11-05 11:07:16 -05:00
committed by Rico Tzschichholz
parent d04faab327
commit 5df1edaf70
3 changed files with 18 additions and 11 deletions

View File

@@ -1002,6 +1002,12 @@ check_add_interface_L (GType instance_type,
NODE_NAME (node));
return FALSE;
}
if (node->data && node->data->class.class)
{
g_warning ("attempting to add an interface (%s) to class (%s) after class_init",
NODE_NAME (iface), NODE_NAME (node));
return FALSE;
}
tnode = lookup_type_node_I (NODE_PARENT_TYPE (iface));
if (NODE_PARENT_TYPE (tnode) && !type_lookup_iface_entry_L (node, tnode))
{