mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Add _g_closure_is_void to check for NULL vfuncs
https://bugzilla.gnome.org/show_bug.cgi?id=661140
This commit is contained in:
parent
57051905f9
commit
1c4f0ca483
@ -1025,6 +1025,42 @@ g_type_iface_meta_marshal (GClosure *closure,
|
||||
callback);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_g_closure_is_void (GClosure *closure,
|
||||
gpointer instance)
|
||||
{
|
||||
GRealClosure *real_closure;
|
||||
GTypeClass *class;
|
||||
gpointer callback;
|
||||
GType itype;
|
||||
guint offset;
|
||||
|
||||
if (closure->is_invalid)
|
||||
return TRUE;
|
||||
|
||||
real_closure = G_REAL_CLOSURE (closure);
|
||||
|
||||
if (real_closure->meta_marshal == g_type_iface_meta_marshal)
|
||||
{
|
||||
itype = (GType) closure->data;
|
||||
offset = GPOINTER_TO_UINT (real_closure->meta_marshal_data);
|
||||
|
||||
class = G_TYPE_INSTANCE_GET_INTERFACE (instance, itype, GTypeClass);
|
||||
callback = G_STRUCT_MEMBER (gpointer, class, offset);
|
||||
return callback == NULL;
|
||||
}
|
||||
else if (real_closure->meta_marshal == g_type_class_meta_marshal)
|
||||
{
|
||||
offset = GPOINTER_TO_UINT (real_closure->meta_marshal_data);
|
||||
|
||||
class = G_TYPE_INSTANCE_GET_CLASS (instance, itype, GTypeClass);
|
||||
callback = G_STRUCT_MEMBER (gpointer, class, offset);
|
||||
return callback == NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
g_type_iface_meta_marshalv (GClosure *closure,
|
||||
GValue *return_value,
|
||||
|
@ -60,6 +60,8 @@ void _g_type_boxed_init (GType type,
|
||||
GBoxedCopyFunc copy_func,
|
||||
GBoxedFreeFunc free_func);
|
||||
|
||||
gboolean _g_closure_is_void (GClosure *closure,
|
||||
gpointer instance);
|
||||
gboolean _g_closure_supports_invoke_va (GClosure *closure);
|
||||
void _g_closure_set_va_marshal (GClosure *closure,
|
||||
GVaClosureMarshal marshal);
|
||||
|
Loading…
Reference in New Issue
Block a user