gtype: Use is_final node bit to check if a type can be derived

This commit is contained in:
Marco Trevisan (Treviño) 2022-12-12 18:18:02 +01:00
parent 5dc8d2ca00
commit f6ac7bc907

View File

@ -797,6 +797,13 @@ check_derivation_I (GType parent_type,
type_descriptive_name_I (parent_type));
return FALSE;
}
if (pnode->is_final)
{
g_critical ("cannot derive '%s' from final parent type '%s'",
type_name,
NODE_NAME (pnode));
return FALSE;
}
finfo = type_node_fundamental_info_I (pnode);
/* ensure flat derivability */
if (!(finfo->type_flags & G_TYPE_FLAG_DERIVABLE))
@ -815,13 +822,6 @@ check_derivation_I (GType parent_type,
NODE_NAME (pnode));
return FALSE;
}
if ((G_TYPE_FLAG_FINAL & GPOINTER_TO_UINT (type_get_qdata_L (pnode, static_quark_type_flags))) == G_TYPE_FLAG_FINAL)
{
g_critical ("cannot derive '%s' from final parent type '%s'",
type_name,
NODE_NAME (pnode));
return FALSE;
}
return TRUE;
}