mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
closure: Support generic marshals for interface returns
Use the newly added g_type_interface_instantiable_prerequisite() to allow closure return values being interfaces by looking up the instantiable type for the interface and using its GValue accessors.
This commit is contained in:
parent
98f0a5a7da
commit
3f2a8d53f0
@ -1258,8 +1258,12 @@ static void
|
|||||||
value_from_ffi_type (GValue *gvalue, gpointer *value)
|
value_from_ffi_type (GValue *gvalue, gpointer *value)
|
||||||
{
|
{
|
||||||
ffi_arg *int_val = (ffi_arg*) value;
|
ffi_arg *int_val = (ffi_arg*) value;
|
||||||
|
GType type;
|
||||||
|
|
||||||
switch (g_type_fundamental (G_VALUE_TYPE (gvalue)))
|
type = G_VALUE_TYPE (gvalue);
|
||||||
|
|
||||||
|
restart:
|
||||||
|
switch (g_type_fundamental (type))
|
||||||
{
|
{
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT:
|
||||||
g_value_set_int (gvalue, (gint) *int_val);
|
g_value_set_int (gvalue, (gint) *int_val);
|
||||||
@ -1318,9 +1322,15 @@ value_from_ffi_type (GValue *gvalue, gpointer *value)
|
|||||||
case G_TYPE_VARIANT:
|
case G_TYPE_VARIANT:
|
||||||
g_value_take_variant (gvalue, *(gpointer*)value);
|
g_value_take_variant (gvalue, *(gpointer*)value);
|
||||||
break;
|
break;
|
||||||
|
case G_TYPE_INTERFACE:
|
||||||
|
type = g_type_interface_instantiatable_prerequisite (type);
|
||||||
|
if (type)
|
||||||
|
goto restart;
|
||||||
|
G_GNUC_FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
g_warning ("value_from_ffi_type: Unsupported fundamental type: %s",
|
g_warning ("value_from_ffi_type: Unsupported fundamental type %s for type %s",
|
||||||
g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))));
|
g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))),
|
||||||
|
g_type_name (G_VALUE_TYPE (gvalue)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user