all: merge fixing pointers casts for g_object_ref()

See related bug https://bugzilla.gnome.org/show_bug.cgi?id=790697

https://mail.gnome.org/archives/desktop-devel-list/2012-July/msg00100.html
This commit is contained in:
Thomas Haller 2017-12-06 10:31:28 +01:00
commit cdbe1ad715
7 changed files with 18 additions and 11 deletions

View file

@ -477,7 +477,7 @@ updated_get_settings_cb (DBusGProxy *proxy,
priv->visible = FALSE;
g_signal_emit (self, signals[VISIBLE], 0, FALSE);
} else {
gs_unref_object NMConnection *self_alive = NULL;
gs_unref_object NMRemoteConnection *self_alive = NULL;
self_alive = g_object_ref (self);
_nm_connection_replace_settings (NM_CONNECTION (self), new_settings);
@ -601,9 +601,10 @@ constructed (GObject *object)
static gboolean
init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
{
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
NMRemoteConnection *self = NM_REMOTE_CONNECTION (initable);
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
GHashTable *hash;
gs_unref_object NMConnection *self_alive = NULL;
gs_unref_object NMRemoteConnection *self_alive = NULL;
if (!dbus_g_proxy_call (priv->proxy, "GetSettings", error,
G_TYPE_INVALID,
@ -611,9 +612,9 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
G_TYPE_INVALID))
return FALSE;
priv->visible = TRUE;
self_alive = g_object_ref (initable);
_nm_connection_replace_settings (NM_CONNECTION (initable), hash);
g_signal_emit (initable, signals[UPDATED], 0, hash);
self_alive = g_object_ref (self);
_nm_connection_replace_settings (NM_CONNECTION (self), hash);
g_signal_emit (self, signals[UPDATED], 0, hash);
g_hash_table_destroy (hash);
/* Get properties */
@ -676,7 +677,7 @@ init_get_settings_cb (DBusGProxy *proxy,
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
GHashTable *settings;
GError *error = NULL;
gs_unref_object NMConnection *self_alive = NULL;
gs_unref_object NMRemoteConnection *self_alive = NULL;
dbus_g_proxy_end_call (proxy, call, &error,
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,

View file

@ -481,4 +481,9 @@ _nm_g_variant_new_printf (const char *format_string, ...)
})
#endif
#if !GLIB_CHECK_VERSION (2, 56, 0)
#define g_object_ref(Obj) ((typeof(Obj)) g_object_ref (Obj))
#define g_object_ref_sink(Obj) ((typeof(Obj)) g_object_ref_sink (Obj))
#endif
#endif /* __NM_GLIB_H__ */

View file

@ -721,6 +721,7 @@ nm_g_object_ref (gpointer obj)
g_object_ref (obj);
return obj;
}
#define nm_g_object_ref(obj) ((typeof (obj)) nm_g_object_ref (obj))
static inline void
nm_g_object_unref (gpointer obj)

View file

@ -202,5 +202,5 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
G_MODULE_EXPORT GObject *
nm_settings_plugin_factory (void)
{
return g_object_ref (nms_ibft_plugin_get ());
return G_OBJECT (g_object_ref (nms_ibft_plugin_get ()));
}

View file

@ -1080,5 +1080,5 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
G_MODULE_EXPORT GObject *
nm_settings_plugin_factory (void)
{
return g_object_ref (settings_plugin_ifcfg_get ());
return G_OBJECT (g_object_ref (settings_plugin_ifcfg_get ()));
}

View file

@ -520,5 +520,5 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
G_MODULE_EXPORT GObject *
nm_settings_plugin_factory (void)
{
return g_object_ref (settings_plugin_ifnet_get ());
return G_OBJECT (g_object_ref (settings_plugin_ifnet_get ()));
}

View file

@ -541,6 +541,6 @@ settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
G_MODULE_EXPORT GObject *
nm_settings_plugin_factory (void)
{
return g_object_ref (settings_plugin_ifupdown_get ());
return G_OBJECT (g_object_ref (settings_plugin_ifupdown_get ()));
}