[maemo-commits] [maemo-commits] r13970 - in projects/haf/trunk/libhildonmime: . debian libhildonmime

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Sep 21 11:25:16 EEST 2007
Author: richard
Date: 2007-09-21 11:25:13 +0300 (Fri, 21 Sep 2007)
New Revision: 13970

Modified:
   projects/haf/trunk/libhildonmime/ChangeLog
   projects/haf/trunk/libhildonmime/debian/changelog
   projects/haf/trunk/libhildonmime/libhildonmime/hildon-mime-open.c
Log:
Fix NB#66935.

Modified: projects/haf/trunk/libhildonmime/ChangeLog
===================================================================
--- projects/haf/trunk/libhildonmime/ChangeLog	2007-09-21 08:20:14 UTC (rev 13969)
+++ projects/haf/trunk/libhildonmime/ChangeLog	2007-09-21 08:25:13 UTC (rev 13970)
@@ -1,5 +1,13 @@
 2007-09-21  Richard Hult  <richard at imendio.com>
 
+	* libhildonmime/hildon-mime-open.c: (mime_launch): Split up the
+	list of files and handle 256 at a time, to bypass the limitation
+	of message size in D-Bus. (The right solution would be to use an
+	array instead of appending, like we wanted to do quite a while ago
+	but couldn't because apps didn't want to change their side.)
+	
+2007-09-21  Richard Hult  <richard at imendio.com>
+
 	* configure.in: Bump version.
 
 	* libhildonmime/hildon-mime-categories.c (xdg_mime_shutdown): 

Modified: projects/haf/trunk/libhildonmime/debian/changelog
===================================================================
--- projects/haf/trunk/libhildonmime/debian/changelog	2007-09-21 08:20:14 UTC (rev 13969)
+++ projects/haf/trunk/libhildonmime/debian/changelog	2007-09-21 08:25:13 UTC (rev 13970)
@@ -1,6 +1,7 @@
 libhildonmime (1.10.0-1) unstable; urgency=low
 
   * Fixes: NB#70451, hildon_uri_get_default_action have too many output
+  * Fixes: NB#66935, File manager crashed while trying to access audio clips
 	
  -- Richard Hult <richard at imendio.com>  Fri, 21 Sep 2007 09:11:23 +0200
 

Modified: projects/haf/trunk/libhildonmime/libhildonmime/hildon-mime-open.c
===================================================================
--- projects/haf/trunk/libhildonmime/libhildonmime/hildon-mime-open.c	2007-09-21 08:20:14 UTC (rev 13969)
+++ projects/haf/trunk/libhildonmime/libhildonmime/hildon-mime-open.c	2007-09-21 08:25:13 UTC (rev 13970)
@@ -271,20 +271,6 @@
 	return success;
 }
 
-static void 
-mime_launch_add_arg (const gchar     *uri, 
-		     DBusMessageIter *iter)
-{
-	if (!g_utf8_validate (uri, -1, NULL)) {
-		g_warning ("Invalid UTF-8 passed to hildon_mime_open\n");
-		return;
-	}
-
-	dprint ("URI: '%s'", uri);
-	
-	dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &uri);
-}
-
 static gboolean 
 mime_launch (DBusConnection *con,
 	     AppEntry       *entry)
@@ -297,6 +283,7 @@
 	gchar           *object_path;
 	gchar           *interface;
 	gboolean         success = TRUE;
+	GSList          *files = entry->files;
 
 	key = entry->service_name;
 	method = "mime_open";
@@ -318,32 +305,50 @@
 	dprint ("Activating service:'%s', object path:'%s', interface:'%s', method:'%s'", 
 		service, object_path, interface, method);
 
-	dprint ("Creating message for service: '%s'", service);
-	msg = dbus_message_new_method_call (service, object_path, interface, method);
+	while (files) {
+		dprint ("Creating message for service: '%s'", service);
+		msg = dbus_message_new_method_call (service, object_path, interface, method);
 
-	if (msg) {
-		dbus_message_set_no_reply (msg, TRUE);
-		dbus_message_iter_init_append (msg, &iter);
+		if (msg) {
+			gint n_files = 0;
+
+			dbus_message_set_no_reply (msg, TRUE);
+			dbus_message_iter_init_append (msg, &iter);
 		
-		dprint ("Adding arguments:");
-		g_slist_foreach (entry->files, (GFunc) mime_launch_add_arg, &iter);
+			dprint ("Adding arguments:");
+
+			while (n_files < 256 && files) {
+				const gchar *uri = files->data;
+
+				if (g_utf8_validate (uri, -1, NULL)) {
+					dprint ("URI: '%s'", uri);
+					dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &uri);
+					n_files++;
+				} else {
+					g_warning ("Invalid UTF-8 passed to hildon_mime_open\n");
+				}
+
+				files = files->next;
+			}
+
+			if (dbus_connection_send (con, msg, NULL) == TRUE) {
+				dprint ("Sent message to service: '%s'", service);
+				dbus_connection_flush (con);
+
+				/* Update the task navigator */
+				success = mime_launch_notify_task_navigator (con, service);
+			} else {
+				dprint ("Couldn't send message to service: '%s'", service);
+				success = FALSE;
+			}
 		
-		if (dbus_connection_send (con, msg, NULL) == TRUE) {
-			dprint ("Sent message to service: '%s'", service);
-			dbus_connection_flush (con);
-
-			/* Update the task navigator */
-			success = mime_launch_notify_task_navigator (con, service);
+			dbus_message_unref (msg);
 		} else {
-			dprint ("Couldn't send message to service: '%s'", service);
+			dprint ("Couldn't create msg with method: 'mime-open' to service: '%s'", 
+				service);
 			success = FALSE;
+			break;
 		}
-		
-		dbus_message_unref (msg);
-	} else {
-		dprint ("Couldn't create msg with method: 'mime-open' to service: '%s'", 
-			service);
-		success = FALSE;
 	}
 
 	g_free (service);
@@ -490,7 +495,6 @@
 		}			
 	}	
 
-
 	num_apps = g_hash_table_size (apps);
 	g_hash_table_foreach (apps, (GHFunc) mime_open_file_list_foreach, &list);
 


More information about the maemo-commits mailing list