RUN_FIRST | RUN_CLEANUP signals with a default handler ignore return values from user handlers
Ever since !1053 (merged), we now accumulate the return values of RUN_CLEANUP handlers, and if the accumulated value does not match the value accumulated in the RUN_FIRST handlers, the RUN_FIRST value will be discarded.
Effectively, user handlers connected to RUN_FIRST | RUN_CLEANUP signals can have their return values ignored. For instance:
g_signal_new_class_handler ("before-send", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_CLEANUP,
(GCallback) default_before_send, before_send_accum, NULL, NULL,
G_TYPE_BOOLEAN, 1, GST_TYPE_RTSP_MESSAGE | G_SIGNAL_TYPE_STATIC_SCOPE);
...
static gboolean
before_send_accum (GSignalInvocationHint * ihint,
GValue * return_accu, const GValue * handler_return, gpointer data)
{
gboolean myboolean;
myboolean = g_value_get_boolean (handler_return);
g_value_set_boolean (return_accu, myboolean);
/* prevent send if FALSE */
return myboolean;
}
...
static gboolean
default_before_send (GstRTSPSrc * src, GstRTSPMessage * msg)
{
GST_DEBUG_OBJECT (src, "default handler");
return TRUE;
}
Here, default_before_send()
always returns TRUE, so if a user handler ever returns FALSE, it will get ignored. This wasn't noticed in !1144 (merged) which adds lots of test cases because the accumulator always returns TRUE there.
I am not sure if this is a bug or not, but it's a change in behaviour. If it is expected, we should document it and add a test for it so it doesn't change again.
Edited by Nirbheek Chauhan