diff options
| author | Michael Biebl <biebl@debian.org> | 2016-05-11 17:08:25 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-05-11 17:08:25 +0200 |
| commit | 73e152af6e3fb4f5848bfb8394484026ff119003 (patch) | |
| tree | d5a8b37778d3a95c51511451b38b6a329b94cb41 /libnm-core/nm-connection.c | |
| parent | 78c3b8801ecf4975e5da1af3b10ae20dd2d876de (diff) | |
Imported Upstream version 1.2.2 upstream/1.2.2
Diffstat (limited to 'libnm-core/nm-connection.c')
| -rw-r--r-- | libnm-core/nm-connection.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index c03e6265..7a0e1f6b 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -2240,13 +2240,19 @@ nm_connection_private_free (NMConnectionPrivate *priv) static NMConnectionPrivate * nm_connection_get_private (NMConnection *connection) { + static GQuark key = 0; NMConnectionPrivate *priv; - priv = g_object_get_data (G_OBJECT (connection), "NMConnectionPrivate"); + nm_assert (NM_IS_CONNECTION (connection)); + + if (G_UNLIKELY (key == 0)) + key = g_quark_from_static_string ("NMConnectionPrivate"); + + priv = g_object_get_qdata ((GObject *) connection, key); if (!priv) { priv = g_slice_new0 (NMConnectionPrivate); - g_object_set_data_full (G_OBJECT (connection), "NMConnectionPrivate", - priv, (GDestroyNotify) nm_connection_private_free); + g_object_set_qdata_full ((GObject *) connection, key, + priv, (GDestroyNotify) nm_connection_private_free); priv->self = connection; priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); |