gdbus: Initialize types at async entrypoints

This isn't a comprehensive fix, but should cover a lot of cases
for GDBus.

https://bugzilla.gnome.org/show_bug.cgi?id=674885
This commit is contained in:
INSUN PYO 2016-10-31 16:36:18 +09:00 committed by Colin Walters
parent 206c54c80b
commit 07465176da
2 changed files with 19 additions and 0 deletions

View File

@ -2688,7 +2688,10 @@ g_dbus_connection_new (GIOStream *stream,
GAsyncReadyCallback callback,
gpointer user_data)
{
_g_dbus_initialize ();
g_return_if_fail (G_IS_IO_STREAM (stream));
g_async_initable_new_async (G_TYPE_DBUS_CONNECTION,
G_PRIORITY_DEFAULT,
cancellable,
@ -2773,6 +2776,7 @@ g_dbus_connection_new_sync (GIOStream *stream,
GCancellable *cancellable,
GError **error)
{
_g_dbus_initialize ();
g_return_val_if_fail (G_IS_IO_STREAM (stream), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_initable_new (G_TYPE_DBUS_CONNECTION,
@ -2828,7 +2832,10 @@ g_dbus_connection_new_for_address (const gchar *address,
GAsyncReadyCallback callback,
gpointer user_data)
{
_g_dbus_initialize ();
g_return_if_fail (address != NULL);
g_async_initable_new_async (G_TYPE_DBUS_CONNECTION,
G_PRIORITY_DEFAULT,
cancellable,
@ -2912,6 +2919,8 @@ g_dbus_connection_new_for_address_sync (const gchar *address,
GCancellable *cancellable,
GError **error)
{
_g_dbus_initialize ();
g_return_val_if_fail (address != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_initable_new (G_TYPE_DBUS_CONNECTION,
@ -7252,6 +7261,8 @@ g_bus_get_sync (GBusType bus_type,
{
GDBusConnection *connection;
_g_dbus_initialize ();
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
connection = get_uninitialized_connection (bus_type, cancellable, error);
@ -7318,6 +7329,8 @@ g_bus_get (GBusType bus_type,
GTask *task;
GError *error = NULL;
_g_dbus_initialize ();
task = g_task_new (NULL, cancellable, callback, user_data);
g_task_set_source_tag (task, g_bus_get);

View File

@ -2021,6 +2021,8 @@ g_dbus_proxy_new (GDBusConnection *connection,
GAsyncReadyCallback callback,
gpointer user_data)
{
_g_dbus_initialize ();
g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
g_return_if_fail ((name == NULL && g_dbus_connection_get_unique_name (connection) == NULL) || g_dbus_is_name (name));
g_return_if_fail (g_variant_is_object_path (object_path));
@ -2171,6 +2173,8 @@ g_dbus_proxy_new_for_bus (GBusType bus_type,
GAsyncReadyCallback callback,
gpointer user_data)
{
_g_dbus_initialize ();
g_return_if_fail (g_dbus_is_name (name));
g_return_if_fail (g_variant_is_object_path (object_path));
g_return_if_fail (g_dbus_is_interface_name (interface_name));
@ -2239,6 +2243,8 @@ g_dbus_proxy_new_for_bus_sync (GBusType bus_type,
{
GInitable *initable;
_g_dbus_initialize ();
g_return_val_if_fail (g_dbus_is_name (name), NULL);
g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
g_return_val_if_fail (g_dbus_is_interface_name (interface_name), NULL);