[gdm] GdmSession: check conversation before accessing it



commit 013a7693d3ca4a2241ba75d4e779b4c582a101c9
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Sep 18 22:03:52 2012 +0200

    GdmSession: check conversation before accessing it
    
    Due to the way methods are handled by GDBus, it's possible we get a
    method invocation after the worker has already exited and the conversation
    freed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684326

 daemon/gdm-session.c |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 22da76a..9a134ff 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -672,11 +672,13 @@ gdm_session_handle_info_query (GdmDBusWorkerManager  *worker_manager_interface,
         g_return_val_if_fail (self->priv->user_verifier_interface != NULL, FALSE);
 
         conversation = find_conversation_by_name (self, service_name);
-        set_pending_query (conversation, invocation);
+        if (conversation != NULL) {
+                set_pending_query (conversation, invocation);
 
-        gdm_dbus_user_verifier_emit_info_query (self->priv->user_verifier_interface,
-                                                service_name,
-                                                query);
+                gdm_dbus_user_verifier_emit_info_query (self->priv->user_verifier_interface,
+                                                        service_name,
+                                                        query);
+        }
 
         return TRUE;
 }
@@ -693,11 +695,13 @@ gdm_session_handle_secret_info_query (GdmDBusWorkerManager  *worker_manager_inte
         g_return_val_if_fail (self->priv->user_verifier_interface != NULL, FALSE);
 
         conversation = find_conversation_by_name (self, service_name);
-        set_pending_query (conversation, invocation);
+        if (conversation != NULL) {
+                set_pending_query (conversation, invocation);
 
-        gdm_dbus_user_verifier_emit_secret_info_query (self->priv->user_verifier_interface,
-                                                       service_name,
-                                                       query);
+                gdm_dbus_user_verifier_emit_secret_info_query (self->priv->user_verifier_interface,
+                                                               service_name,
+                                                               query);
+        }
 
         return TRUE;
 }
@@ -2328,9 +2332,11 @@ gdm_session_open_session (GdmSession *self,
 
         conversation = find_conversation_by_name (self, service_name);
 
-        gdm_dbus_worker_call_open (conversation->worker_proxy,
-                                   NULL,
-                                   (GAsyncReadyCallback) on_opened, conversation);
+        if (conversation != NULL) {
+                gdm_dbus_worker_call_open (conversation->worker_proxy,
+                                           NULL,
+                                           (GAsyncReadyCallback) on_opened, conversation);
+        }
 }
 
 static void
@@ -2538,7 +2544,9 @@ gdm_session_answer_query (GdmSession *self,
 
         conversation = find_conversation_by_name (self, service_name);
 
-        answer_pending_query (conversation, text);
+        if (conversation != NULL) {
+                answer_pending_query (conversation, text);
+        }
 }
 
 void



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