Make g_type_interface_prerequisites() only return one instantiable type

Previously, the code had a heisenbug and could potentially return
superclasses, too. In fact, it was based on the behavior of malloc.

https://bugzilla.redhat.com/show_bug.cgi?id=554678
This commit is contained in:
Benjamin Otte 2010-02-17 08:45:28 +01:00
parent 9fdbae9344
commit 63a6666ab7

View File

@ -1622,9 +1622,11 @@ g_type_interface_prerequisites (GType interface_type,
{
GType prerequisite = IFACE_NODE_PREREQUISITES (iface)[i];
TypeNode *node = lookup_type_node_I (prerequisite);
if (node->is_instantiatable &&
(!inode || type_node_is_a_L (node, inode)))
inode = node;
if (node->is_instantiatable)
{
if (!inode || type_node_is_a_L (node, inode))
inode = node;
}
else
types[n++] = NODE_TYPE (node);
}