Don't set a va marshaller if a marshaller was set

Otherwise we get warnings when the caller later tries to set a
va marshaller with g_signal_set_va_marshaller.

https://bugzilla.gnome.org/show_bug.cgi?id=769076
This commit is contained in:
Matthias Clasen 2016-07-28 08:51:17 -04:00
parent 097f70828f
commit ef16cbee5b

View File

@ -1628,6 +1628,7 @@ g_signal_newv (const gchar *signal_name,
guint signal_id, i; guint signal_id, i;
SignalNode *node; SignalNode *node;
GSignalCMarshaller builtin_c_marshaller; GSignalCMarshaller builtin_c_marshaller;
GSignalCVaMarshaller builtin_va_marshaller;
GSignalCVaMarshaller va_marshaller; GSignalCVaMarshaller va_marshaller;
g_return_val_if_fail (signal_name != NULL, 0); g_return_val_if_fail (signal_name != NULL, 0);
@ -1736,14 +1737,14 @@ g_signal_newv (const gchar *signal_name,
node->accumulator = NULL; node->accumulator = NULL;
builtin_c_marshaller = NULL; builtin_c_marshaller = NULL;
va_marshaller = NULL; builtin_va_marshaller = NULL;
/* Pick up built-in va marshallers for standard types, and /* Pick up built-in va marshallers for standard types, and
instead of generic marshaller if no marshaller specified */ instead of generic marshaller if no marshaller specified */
if (n_params == 0 && return_type == G_TYPE_NONE) if (n_params == 0 && return_type == G_TYPE_NONE)
{ {
builtin_c_marshaller = g_cclosure_marshal_VOID__VOID; builtin_c_marshaller = g_cclosure_marshal_VOID__VOID;
va_marshaller = g_cclosure_marshal_VOID__VOIDv; builtin_va_marshaller = g_cclosure_marshal_VOID__VOIDv;
} }
else if (n_params == 1 && return_type == G_TYPE_NONE) else if (n_params == 1 && return_type == G_TYPE_NONE)
{ {
@ -1751,7 +1752,7 @@ g_signal_newv (const gchar *signal_name,
else if (g_type_is_a (param_types[0] & ~G_SIGNAL_TYPE_STATIC_SCOPE, G_TYPE_ ##__type__)) \ else if (g_type_is_a (param_types[0] & ~G_SIGNAL_TYPE_STATIC_SCOPE, G_TYPE_ ##__type__)) \
{ \ { \
builtin_c_marshaller = g_cclosure_marshal_VOID__ ## __type__; \ builtin_c_marshaller = g_cclosure_marshal_VOID__ ## __type__; \
va_marshaller = g_cclosure_marshal_VOID__ ## __type__ ##v; \ builtin_va_marshaller = g_cclosure_marshal_VOID__ ## __type__ ##v; \
} }
if (0) {} if (0) {}
@ -1777,13 +1778,18 @@ g_signal_newv (const gchar *signal_name,
if (c_marshaller == NULL) if (c_marshaller == NULL)
{ {
if (builtin_c_marshaller) if (builtin_c_marshaller)
c_marshaller = builtin_c_marshaller; {
c_marshaller = builtin_c_marshaller;
va_marshaller = builtin_va_marshaller;
}
else else
{ {
c_marshaller = g_cclosure_marshal_generic; c_marshaller = g_cclosure_marshal_generic;
va_marshaller = g_cclosure_marshal_generic_va; va_marshaller = g_cclosure_marshal_generic_va;
} }
} }
else
va_marshaller = NULL;
node->c_marshaller = c_marshaller; node->c_marshaller = c_marshaller;
node->va_marshaller = va_marshaller; node->va_marshaller = va_marshaller;