On 02/06/2012 11:45 AM, Dan Williams wrote: >> 'g_simple_async_result_take_error' was introduced with commit 9fd98ef9 >> 'g_clear_object' was introduced with commit cc90f101 >> >> >> Was this intended? > > I think so
Actually, I meant to stick with the current glib requirements, I just forgot that take_error() was new-ish, and then the g_clear_object() slipped by without me noticing. Patch attached. I made a compat macro for take_error, since it's useful, and just rewrote the one use of g_clear_object(). Oh, this is untested since I don't have a machine with old enough glib... Thomas, can you try it? -- Dan
>From a366864a6f38eea4b336750b91e08281c72e3876 Mon Sep 17 00:00:00 2001 From: Dan Winship <[email protected]> Date: Mon, 6 Feb 2012 15:11:43 -0500 Subject: [PATCH] libnm-glib: fix to not depend on newer glib --- include/nm-glib-compat.h | 10 ++++++++++ libnm-glib/nm-client.c | 1 + libnm-glib/nm-object.c | 3 ++- libnm-glib/nm-remote-connection.c | 1 + libnm-glib/nm-remote-settings.c | 1 + 5 files changed, 15 insertions(+), 1 deletions(-) diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h index 4b96871..c404ca6 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib-compat.h @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager -- Network link manager * * Dan Williams <[email protected]> @@ -29,4 +30,13 @@ #define g_value_get_schar g_value_get_char #endif +#if !GLIB_CHECK_VERSION(2,28,0) +#define g_simple_async_result_take_error(result, error) \ + G_STMT_START { \ + GError *__error = error; \ + g_simple_async_result_set_from_error (result, __error); \ + g_error_free (__error); \ + } G_STMT_END +#endif + #endif /* NM_GLIB_COMPAT_H */ diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index 06cf3a5..6c9eaa6 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -36,6 +36,7 @@ #include "nm-vpn-connection.h" #include "nm-object-cache.h" #include "nm-dbus-glib-types.h" +#include "nm-glib-compat.h" void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled); diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index d76129d..51219b3 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -602,7 +602,8 @@ object_created (GObject *obj, gpointer user_data) } else { GObject **obj_p = pi->field; - g_clear_object (obj_p); + if (*obj_p) + g_object_unref (*obj_p); *obj_p = odata->objects[0]; } diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index be78a09..c5e3864 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -30,6 +30,7 @@ #include "nm-remote-connection.h" #include "nm-remote-connection-private.h" #include "nm-dbus-glib-types.h" +#include "nm-glib-compat.h" #define NM_REMOTE_CONNECTION_BUS "bus" diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index e8d3386..588c120 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -29,6 +29,7 @@ #include "nm-dbus-glib-types.h" #include "nm-remote-settings.h" #include "nm-remote-connection-private.h" +#include "nm-glib-compat.h" static void nm_remote_settings_initable_iface_init (GInitableIface *iface); static void nm_remote_settings_async_initable_iface_init (GAsyncInitableIface *iface); -- 1.7.7.5
_______________________________________________ networkmanager-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/networkmanager-list
