mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 14:42:10 +01:00
Report only the most specific instantiatable prerequisite, filter out all
* gtype.c (g_type_interface_prerequisites): Report only the most specific instantiatable prerequisite, filter out all supertypes of this one (the supertypes are added to the prerequisites array for technical reasons).
This commit is contained in:
parent
f74c33fc1d
commit
b95ffb852c
@ -1241,20 +1241,30 @@ g_type_interface_prerequisites (GType interface_type,
|
|||||||
iface = lookup_type_node_I (interface_type);
|
iface = lookup_type_node_I (interface_type);
|
||||||
if (iface)
|
if (iface)
|
||||||
{
|
{
|
||||||
GType *prerequisites;
|
GType *types;
|
||||||
guint i;
|
TypeNode *inode = NULL;
|
||||||
|
guint i, n = 0;
|
||||||
|
|
||||||
G_READ_LOCK (&type_rw_lock);
|
G_READ_LOCK (&type_rw_lock);
|
||||||
prerequisites = g_new (GType, IFACE_NODE_N_PREREQUISITES (iface) + 1);
|
types = g_new0 (GType, IFACE_NODE_N_PREREQUISITES (iface) + 1);
|
||||||
for (i = 0; i < IFACE_NODE_N_PREREQUISITES (iface); i++)
|
for (i = 0; i < IFACE_NODE_N_PREREQUISITES (iface); i++)
|
||||||
prerequisites[i] = IFACE_NODE_PREREQUISITES (iface)[i];
|
{
|
||||||
prerequisites[i] = 0;
|
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;
|
||||||
|
else
|
||||||
|
types[n++] = NODE_TYPE (node);
|
||||||
|
}
|
||||||
|
if (inode)
|
||||||
|
types[n++] = NODE_TYPE (inode);
|
||||||
|
|
||||||
if (n_prerequisites)
|
if (n_prerequisites)
|
||||||
*n_prerequisites = IFACE_NODE_N_PREREQUISITES (iface);
|
*n_prerequisites = n;
|
||||||
G_READ_UNLOCK (&type_rw_lock);
|
G_READ_UNLOCK (&type_rw_lock);
|
||||||
|
|
||||||
return prerequisites;
|
return types;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user