summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-01-18 14:03:16 +0100
committerBenjamin Otte <otte@redhat.com>2010-01-18 14:46:55 +0100
commit914120b9701650ccf7bede1907b69b521ca43236 (patch)
tree6ce7bc1ecd9ca91516c8890ce07a9f3dfd3848e1 /gobject
parent956b3b507d03b6d10f8bef34b3775a409c5ba9ee (diff)
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
Diffstat (limited to 'gobject')
-rw-r--r--gobject/gobject.c2
-rw-r--r--gobject/gsignal.c4
-rw-r--r--gobject/gvaluecollector.h3
3 files changed, 4 insertions, 5 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c
index bf45d6263..da2a5050a 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -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)
{
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index 9004ee833..c7c16799b 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -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++)
diff --git a/gobject/gvaluecollector.h b/gobject/gvaluecollector.h
index c0aa79058..d7f66e22d 100644
--- a/gobject/gvaluecollector.h
+++ b/gobject/gvaluecollector.h
@@ -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