[gdm/rhel-7.9: 29/51] libgdm: drop support for serializing multiple opens




commit 8582b67a1628e762964098bbb6b304e501e9373a
Author: Ray Strode <rstrode redhat com>
Date:   Mon May 14 14:48:31 2018 -0400

    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

 libgdm/gdm-client.c | 111 +++++++++++++++++++---------------------------------
 1 file changed, 40 insertions(+), 71 deletions(-)
---
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index 58ede0aab..06dfe725e 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;
 };
 
@@ -423,53 +422,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;
+        }
+
+        ret = gdm_manager_call_open_session_sync (client->priv->manager,
+                                                  &client->priv->address,
+                                                  cancellable,
+                                                  error);
 
-                g_debug ("GdmClient: connecting to address: %s", client->priv->address);
+        if (!ret) {
+                g_clear_object (&client->priv->manager);
+                goto out;
+        }
 
-                client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address,
-                                                                                   
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
-                                                                                   NULL,
-                                                                                   cancellable,
-                                                                                   error);
+        g_debug ("GdmClient: connecting to address: %s", client->priv->address);
 
-                if (client->priv->connection == NULL) {
-                        g_clear_object (&client->priv->manager);
-                        g_clear_pointer (&client->priv->address, g_free);
-                        goto out;
-                }
+        client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address,
+                                                                           
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                                                           NULL,
+                                                                           cancellable,
+                                                                           error);
 
-                g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
-                                           (gpointer *)
-                                           &client->priv->connection);
-        } else {
-                client->priv->connection = g_object_ref (client->priv->connection);
+        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;
 }
@@ -555,25 +551,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,
@@ -585,7 +562,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;
         }
 
@@ -597,7 +573,6 @@ gdm_client_open_connection_finish (GdmClient      *client,
                 connection = NULL;
         }
 
-        finish_pending_opens (client, NULL);
         return TRUE;
 }
 
@@ -624,17 +599,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);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]