From 41937c363131ff9cb436930ac60c555f7436fdbf Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 27 Jul 2020 01:57:57 +0100 Subject: [PATCH] gobject: Document that g_object_new() zeros out private data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s already mentioned at https://developer.gnome.org/gobject/stable/chapter-gobject.html#gobject-instantiation, but is important enough that mentioning it in the documentation for `g_object_new()` seems helpful. Signed-off-by: Philip Withnall Fixes: #1022 --- gobject/gobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gobject/gobject.c b/gobject/gobject.c index a9a4350c2..d8a31a3df 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -1745,7 +1745,9 @@ g_object_get_type (void) * Creates a new instance of a #GObject subtype and sets its properties. * * Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) - * which are not explicitly specified are set to their default values. + * which are not explicitly specified are set to their default values. Any + * private data for the object is guaranteed to be initialized with zeros, as + * per g_type_create_instance(). * * Note that in C, small integer types in variable argument lists are promoted * up to #gint or #guint as appropriate, and read back accordingly. #gint is 32