diff options
author | Ray Strode <rstrode@redhat.com> | 2018-05-14 14:48:31 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2018-05-16 10:01:15 -0400 |
commit | 6f8498ca6ccf09877d262077becd71f26c941174 (patch) | |
tree | 8c9dbeb36ec604b1d48945a55be17def8ca3236d /libgdm | |
parent | ccba35d58ae27b02979310d5914a96186afa31de (diff) | |
download | gdm-6f8498ca6ccf09877d262077becd71f26c941174.tar.gz |
libgdm: drop support for serializing multiple opens
Right now libgdm tries to handle multiple simultaneous
open calls at the same time by serializing the requests
and giving them all the same connection. It's broken,
though.
- The pending_opens list is never populated, so we
end up just doing multiple simultaneous open
operations at a time anyway.
- The finish code ends up calling
g_task_return_error (task, NULL) instead of
g_task_return_pointer in the non-error case.
Since the feature doesn't work, drop it for now.
https://bugzilla.gnome.org/show_bug.cgi?id=795940
Diffstat (limited to 'libgdm')
-rw-r--r-- | libgdm/gdm-client.c | 111 |
1 files changed, 40 insertions, 71 deletions
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c index b5f35306..61bcbd37 100644 --- a/libgdm/gdm-client.c +++ b/libgdm/gdm-client.c @@ -51,7 +51,6 @@ struct GdmClientPrivate GDBusConnection *connection; char *address; - GList *pending_opens; char **enabled_extensions; }; @@ -421,53 +420,50 @@ gdm_client_open_connection_sync (GdmClient *client, g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); - if (client->priv->manager == NULL) { - client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_NONE, - "org.gnome.DisplayManager", - "/org/gnome/DisplayManager/Manager", - cancellable, - error); - - if (client->priv->manager == NULL) { - goto out; - } - } else { - client->priv->manager = g_object_ref (client->priv->manager); + if (client->priv->connection != NULL) { + g_object_ref (client->priv->connection); + return TRUE; } - if (client->priv->connection == NULL) { - ret = gdm_manager_call_open_session_sync (client->priv->manager, - &client->priv->address, - cancellable, - error); + client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.gnome.DisplayManager", + "/org/gnome/DisplayManager/Manager", + cancellable, + error); - if (!ret) { - g_clear_object (&client->priv->manager); - goto out; - } + if (client->priv->manager == NULL) { + goto out; + } - g_debug ("GdmClient: connecting to address: %s", client->priv->address); + ret = gdm_manager_call_open_session_sync (client->priv->manager, + &client->priv->address, + cancellable, + error); - client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address, - G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, - NULL, - cancellable, - error); + if (!ret) { + g_clear_object (&client->priv->manager); + goto out; + } - if (client->priv->connection == NULL) { - g_clear_object (&client->priv->manager); - g_clear_pointer (&client->priv->address, g_free); - goto out; - } + g_debug ("GdmClient: connecting to address: %s", client->priv->address); - g_object_add_weak_pointer (G_OBJECT (client->priv->connection), - (gpointer *) - &client->priv->connection); - } else { - client->priv->connection = g_object_ref (client->priv->connection); + client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address, + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, + NULL, + cancellable, + error); + + if (client->priv->connection == NULL) { + g_clear_object (&client->priv->manager); + g_clear_pointer (&client->priv->address, g_free); + goto out; } + g_object_add_weak_pointer (G_OBJECT (client->priv->connection), + (gpointer *) + &client->priv->connection); + out: return client->priv->connection != NULL; } @@ -551,25 +547,6 @@ on_got_manager_for_opening_connection (GdmClient *client, task); } -static void -finish_pending_opens (GdmClient *client, - GError *error) -{ - GList *node; - - for (node = client->priv->pending_opens; - node != NULL; - node = node->next) { - - GTask *task = node->data; - - g_task_return_error (task, error); - g_object_unref (task); - } - g_clear_pointer (&client->priv->pending_opens, - (GDestroyNotify) g_list_free); -} - static gboolean gdm_client_open_connection_finish (GdmClient *client, GAsyncResult *result, @@ -581,7 +558,6 @@ gdm_client_open_connection_finish (GdmClient *client, connection = g_task_propagate_pointer (G_TASK (result), error); if (connection == NULL) { - finish_pending_opens (client, *error); return FALSE; } @@ -593,7 +569,6 @@ gdm_client_open_connection_finish (GdmClient *client, connection = NULL; } - finish_pending_opens (client, NULL); return TRUE; } @@ -620,17 +595,11 @@ gdm_client_open_connection (GdmClient *client, return; } - if (client->priv->pending_opens == NULL) { - get_manager (client, - cancellable, - (GAsyncReadyCallback) - on_got_manager_for_opening_connection, - task); - } else { - client->priv->pending_opens = g_list_prepend (client->priv->pending_opens, - task); - } - + get_manager (client, + cancellable, + (GAsyncReadyCallback) + on_got_manager_for_opening_connection, + task); } /** |