Ensure values are memset to 0 when calling G_VALUE_COLLECT_INIT()

The reason we need to enforce this is that the GTypeValueTable
documentation explicitly states that memory is memset to 0 when the
value_init function is called.

https://bugzilla.gnome.org/show_bug.cgi?id=603590
This commit is contained in:
Benjamin Otte 2010-01-18 14:03:16 +01:00
parent 956b3b507d
commit 914120b970
3 changed files with 4 additions and 5 deletions

View File

@ -1338,7 +1338,7 @@ g_object_new_valist (GType object_type,
class = g_type_class_ref (object_type);
params = g_new (GParameter, n_alloced_params);
params = g_new0 (GParameter, n_alloced_params);
name = first_property_name;
while (name)
{

View File

@ -1971,7 +1971,7 @@ g_signal_chain_from_overridden_handler (gpointer instance,
va_start (var_args, instance);
signal_return_type = node->return_type;
instance_and_params = g_slice_alloc (sizeof (GValue) * (n_params + 1));
instance_and_params = g_slice_alloc0 (sizeof (GValue) * (n_params + 1));
param_values = instance_and_params + 1;
for (i = 0; i < node->n_params; i++)
@ -2938,7 +2938,7 @@ g_signal_emit_valist (gpointer instance,
n_params = node->n_params;
signal_return_type = node->return_type;
instance_and_params = g_slice_alloc (sizeof (GValue) * (n_params + 1));
instance_and_params = g_slice_alloc0 (sizeof (GValue) * (n_params + 1));
param_values = instance_and_params + 1;
for (i = 0; i < node->n_params; i++)

View File

@ -69,8 +69,7 @@ union _GTypeCValue
/**
* G_VALUE_COLLECT_INIT:
* @value: a #GValue return location. @value is supposed to be clean (freshly
* initialized and/or freed).
* @value: a #GValue return location. @value must contain only 0 bytes.
* @_value_type: the #GType to use for @value.
* @var_args: the va_list variable; it may be evaluated multiple times
* @flags: flags which are passed on to the collect_value() function of