g_source_set_closure requires closure_callback for standard GLib source of child_watch type
Submitted by Andrey Tsyvarev
Link to original bug (#615512)
Description
Description of g_source_set_closure states:
void g_source_set_closure(GSource *source, GClosure *closure);
Set the callback for a source as a GClosure.
If the source is not one of the standard GLib types, the closure_callback and closure_marshal fields of the GSourceFuncs structure must have been filled in with pointers to appropriate functions.
It follows from the above description that GSource of "standard" types (e.g. the types provided in GLib library) can work with GClosure even when closure_callback and closure_marshal are not set in GSource.
This is true for the following types of GSource:
timeout (created by g_timeoute_source_new) idle (created by g_idle_source_new) io watch (created by g_io_create_watch).
All these types of GSource work with the closure as with GCClosure, which callback has the same prototype as the "native" callback of the corresponding GSource.
However GSource of type child watch (created by g_child_watch_source_new) reports error (via 'stderr' stream) when one calls g_source_set_closure for it without 'closure_callback' field set. In addition, the closure is not set as a callback mechanism of the source.
As GSource of child watch type is also a standard type for GLib (like timeout, io watch, etc.), it should be handled the same way as the other standard types.
Version: 2.24.x