Closure
A variant of g_closure_new_simple() which stores @object in the
Return
a newly allocated #GClosure
Parameters
the size of the structure to allocate, must be at least sizeof (GClosure)
a #GObject pointer to store in the @data field of the newly allocated #GClosure
Allocates a struct of the given size and initializes the initial part as a #GClosure.
This function is mainly useful when implementing new types of closures:
|[ typedef struct _MyClosure MyClosure; struct _MyClosure { GClosure closure; // extra data goes here };
static void my_closure_finalize (gpointer notify_data, GClosure *closure) { MyClosure *my_closure = (MyClosure *)closure;
// free extra data here }
MyClosure *my_closure_new (gpointer data) { GClosure *closure; MyClosure *my_closure;
closure = g_closure_new_simple (sizeof (MyClosure), data); my_closure = (MyClosure *) closure;
// initialize extra data here
g_closure_add_finalize_notifier (closure, notify_data, my_closure_finalize); return my_closure; } ]|
Return
a floating reference to a new #GClosure
Parameters
the size of the structure to allocate, must be at least sizeof (GClosure)
data to store in the @data field of the newly allocated #GClosure
Allocate a new Closure.
This instance will be allocated on the native heap and automatically freed when this class instance is garbage collected.
Allocate a new Closure using the provided AutofreeScope.
The AutofreeScope manages the allocation lifetime. The most common usage is with memScoped
.
Parameters
The AutofreeScope to allocate this structure in.
Allocate a new Closure.
This instance will be allocated on the native heap and automatically freed when this class instance is garbage collected.
Parameters
Indicates whether the closure is currently being invoked with g_closure_invoke()
Indicates whether the closure has been invalidated by g_closure_invalidate()
Allocate a new Closure using the provided AutofreeScope.
The AutofreeScope manages the allocation lifetime. The most common usage is with memScoped
.
Parameters
Indicates whether the closure is currently being invoked with g_closure_invoke()
Indicates whether the closure has been invalidated by g_closure_invalidate()
The AutofreeScope to allocate this structure in.