gvfs r2342 - in trunk: . common



Author: alexl
Date: Wed Mar 18 21:03:15 2009
New Revision: 2342
URL: http://svn.gnome.org/viewvc/gvfs?rev=2342&view=rev

Log:
2009-03-18  Alexander Larsson  <alexl redhat com>

	Bug 575728 â crash in Open Folder: mountin a crypto volume

        * common/gvfsdaemonprotocol.h:
        * common/gmountoperationdbus.c:
	Handle the new "aborted" signal

        * common/gmountsource.c:
	Fix argument order in g_mount_source_ask_password_finish call.
	stop signal emissions in ask_password and ask_question handlers
	to avoid the default handler sending a not implemented error.
	Handle the new "aborted" signal.




Modified:
   trunk/ChangeLog
   trunk/common/gmountoperationdbus.c
   trunk/common/gmountsource.c
   trunk/common/gvfsdaemonprotocol.h

Modified: trunk/common/gmountoperationdbus.c
==============================================================================
--- trunk/common/gmountoperationdbus.c	(original)
+++ trunk/common/gmountoperationdbus.c	Wed Mar 18 21:03:15 2009
@@ -51,6 +51,8 @@
 						       DBusMessage         *message);
 static void              mount_op_ask_question        (GMountOperationDBus *op_dbus,
 						       DBusMessage         *message);
+static void              mount_op_aborted             (GMountOperationDBus *op_dbus,
+						       DBusMessage         *message);
 
 static void
 g_mount_operation_dbus_free (GMountOperationDBus *op_dbus)
@@ -131,6 +133,10 @@
 					G_VFS_DBUS_MOUNT_OPERATION_INTERFACE,
 					G_VFS_DBUS_MOUNT_OPERATION_OP_ASK_QUESTION))
     mount_op_ask_question (op_dbus, message);
+  else if (dbus_message_is_method_call (message,
+					G_VFS_DBUS_MOUNT_OPERATION_INTERFACE,
+					G_VFS_DBUS_MOUNT_OPERATION_OP_ABORTED))
+    mount_op_aborted (op_dbus, message);
   else
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
@@ -322,3 +328,10 @@
   
   dbus_free_string_array (choices);
 }
+
+static void
+mount_op_aborted (GMountOperationDBus *op_dbus,
+		  DBusMessage         *message)
+{
+  g_signal_emit_by_name (op_dbus->op, "aborted");
+}

Modified: trunk/common/gmountsource.c
==============================================================================
--- trunk/common/gmountsource.c	(original)
+++ trunk/common/gmountsource.c	Wed Mar 18 21:03:15 2009
@@ -433,8 +433,8 @@
   handled = g_mount_source_ask_password_finish (source,
                                                 res,
                                                 &aborted,
-                                                &username,
                                                 &password,
+                                                &username,
                                                 &domain,
 						NULL,
 						&password_save);
@@ -475,6 +475,7 @@
                                      flags,
 				     op_ask_password_reply,
 				     g_object_ref (op));
+  g_signal_stop_emission_by_name (op, "ask_password");
   return TRUE;
 }
 
@@ -695,9 +696,41 @@
 				     n_choices,
 				     op_ask_question_reply,
 				     g_object_ref (op));
+  g_signal_stop_emission_by_name (op, "ask_question");
   return TRUE;
 }
 
+static gboolean
+op_aborted (GMountOperation *op,
+	    GMountSource    *source)
+{
+  DBusMessage *message;
+  DBusConnection *connection;
+
+  /* If no dbus id specified, reply that we weren't handled */
+  if (source->dbus_id[0] == 0)
+    goto out;
+
+  connection = dbus_bus_get (DBUS_BUS_SESSION, NULL);
+  if (connection == NULL)
+    goto out;
+  
+  message = dbus_message_new_method_call (source->dbus_id,
+					  source->obj_path,
+					  G_VFS_DBUS_MOUNT_OPERATION_INTERFACE,
+					  G_VFS_DBUS_MOUNT_OPERATION_OP_ABORTED);
+
+  if (message)
+    {
+      dbus_connection_send (connection, message, NULL);
+      dbus_message_unref (message);
+    }
+
+ out:
+  return TRUE;
+}
+
+
 GMountOperation *
 g_mount_source_get_operation (GMountSource *mount_source)
 {
@@ -711,6 +744,7 @@
 
   g_signal_connect (op, "ask_password", (GCallback)op_ask_password, mount_source);
   g_signal_connect (op, "ask_question", (GCallback)op_ask_question, mount_source);
+  g_signal_connect (op, "aborted", (GCallback)op_aborted, mount_source);
 
   return op;
 }

Modified: trunk/common/gvfsdaemonprotocol.h
==============================================================================
--- trunk/common/gvfsdaemonprotocol.h	(original)
+++ trunk/common/gvfsdaemonprotocol.h	Wed Mar 18 21:03:15 2009
@@ -73,6 +73,7 @@
 #define G_VFS_DBUS_MOUNT_OPERATION_INTERFACE "org.gtk.vfs.MountOperation"
 #define G_VFS_DBUS_MOUNT_OPERATION_OP_ASK_PASSWORD "askPassword"
 #define G_VFS_DBUS_MOUNT_OPERATION_OP_ASK_QUESTION "askQuestion"
+#define G_VFS_DBUS_MOUNT_OPERATION_OP_ABORTED "aborted"
 
 /* Implemented by the spawner of a process, the spawned process sends the
    spawned message (with noreply) when it has spawned and gotten a dbus id */



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