[glib: 2/9] gparam: Remove unsynchronized write to g_type field
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/9] gparam: Remove unsynchronized write to g_type field
- Date: Tue, 5 Mar 2019 11:46:58 +0000 (UTC)
commit fba7f7e097e787a4689bbcb41b0c5c51e900722e
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date: Thu Feb 21 00:00:00 2019 +0000
gparam: Remove unsynchronized write to g_type field
GValue g_type field is used for synchronization with g_once_init_enter,
and so it should be written to only with g_once_init_leave.
Replace structure copy with memcpy that copies the one remaining field
of GValue, i.e., data array.
gobject/gparam.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/gobject/gparam.c b/gobject/gparam.c
index 79ee834d5..6f33f027b 100644
--- a/gobject/gparam.c
+++ b/gobject/gparam.c
@@ -1561,8 +1561,7 @@ g_param_spec_get_default_value (GParamSpec *pspec)
g_param_value_set_default (pspec, &default_value);
/* store all but the type */
- default_value.g_type = 0;
- priv->default_value = default_value;
+ memcpy (priv->default_value.data, default_value.data, sizeof (default_value.data));
g_once_init_leave (&priv->default_value.g_type, pspec->value_type);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]