mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-07 00:31:11 +00:00
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).
This commit is contained in:
parent
a03e7fb74f
commit
320464490e
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue