From 320464490e97c74c5f04651efef0341d6f04b1c5 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 17 Jul 2012 09:41:15 -0400 Subject: [PATCH] libnm-glib: fix GAsyncInitable implementations If a class implements init_async, it should implement init_finish too, rather than assuming the default implementation will do the right thing (which it briefly didn't in glib 2.33). --- libnm-glib/nm-client.c | 12 ++++++++++++ libnm-glib/nm-object.c | 6 +----- libnm-glib/nm-remote-connection.c | 12 ++++++++++++ libnm-glib/nm-remote-settings.c | 12 ++++++++++++ 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index fa8d508df..178a5fdd4 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -1566,6 +1566,17 @@ init_async (GAsyncInitable *initable, int io_priority, G_TYPE_INVALID); } +static gboolean +init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) +{ + GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + + if (g_simple_async_result_propagate_error (simple, error)) + return FALSE; + else + return TRUE; +} + static void dispose (GObject *object) { @@ -1923,4 +1934,5 @@ nm_client_async_initable_iface_init (GAsyncInitableIface *iface) nm_client_parent_async_initable_iface = g_type_interface_peek_parent (iface); iface->init_async = init_async; + iface->init_finish = init_finish; } diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index 756bfa7ab..cba387758 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -205,14 +205,10 @@ init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); - /* This is needed for now because of bug 667375; it can go away - * when we depend on glib >= 2.38 - */ - if (g_simple_async_result_propagate_error (simple, error)) return FALSE; else - return g_simple_async_result_get_op_res_gboolean (simple); + return TRUE; } static void diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index e8b99dff9..64df586e7 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -448,6 +448,17 @@ init_async (GAsyncInitable *initable, int io_priority, } +static gboolean +init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) +{ + GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + + if (g_simple_async_result_propagate_error (simple, error)) + return FALSE; + else + return TRUE; +} + static void nm_remote_connection_init (NMRemoteConnection *self) { @@ -563,4 +574,5 @@ static void nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface) { iface->init_async = init_async; + iface->init_finish = init_finish; } diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index 19d865c06..7748f4f09 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -1035,6 +1035,17 @@ init_async (GAsyncInitable *initable, int io_priority, G_TYPE_INVALID); } +static gboolean +init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) +{ + GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + + if (g_simple_async_result_propagate_error (simple, error)) + return FALSE; + else + return TRUE; +} + static void dispose (GObject *object) { @@ -1198,4 +1209,5 @@ static void nm_remote_settings_async_initable_iface_init (GAsyncInitableIface *iface) { iface->init_async = init_async; + iface->init_finish = init_finish; }