[brasero] Fix #588323 - crash in Disc Copier: Dragging a track from Ba...



commit 5495cbe9d5562f1d658df94af1d937204a8406ea
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Tue Nov 3 21:30:26 2009 +0100

    Fix #588323 -  crash in Disc Copier: Dragging a track from Ba...
    Last comment.
    Banshee packs uris in a strange way that is not properly understood by some stock gtk+ functions like gtk_selection_data_get_uris () which returns NULL whereas g_uri_list_extract_uris () is fine.
    So if the first fails try the other one.

 libbrasero-burn/brasero-track-data-cfg.c |    7 +++++++
 src/brasero-audio-disc.c                 |    2 +-
 src/brasero-multi-dnd.c                  |    7 +++++++
 src/brasero-video-tree-model.c           |   19 ++++++++++++++++---
 4 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/libbrasero-burn/brasero-track-data-cfg.c b/libbrasero-burn/brasero-track-data-cfg.c
index a201e04..df94d39 100644
--- a/libbrasero-burn/brasero-track-data-cfg.c
+++ b/libbrasero-burn/brasero-track-data-cfg.c
@@ -1179,6 +1179,13 @@ brasero_track_data_cfg_drag_data_received (GtkTreeDragDest *drag_dest,
 		 * success is enough to return TRUE. */
 		success = FALSE;
 		uris = gtk_selection_data_get_uris (selection_data);
+		if (!uris) {
+			const guchar *selection_data_raw;
+
+			selection_data_raw = gtk_selection_data_get_data (selection_data);
+			uris = g_uri_list_extract_uris ((gchar *) selection_data_raw);
+		}
+
 		if (!uris)
 			return TRUE;
 
diff --git a/src/brasero-audio-disc.c b/src/brasero-audio-disc.c
index 6608fa0..6994ea6 100644
--- a/src/brasero-audio-disc.c
+++ b/src/brasero-audio-disc.c
@@ -1002,7 +1002,7 @@ brasero_audio_disc_add_uri (BraseroDisc *disc,
 	GtkTreePath *treepath = NULL;
 	BraseroAudioDisc *audio_disc;
 	BraseroDiscResult result;
-
+g_print ("RECEIVED\n");
 	audio_disc = BRASERO_AUDIO_DISC (disc);
 	result = brasero_audio_disc_add_uri_real (audio_disc,
 						  uri,
diff --git a/src/brasero-multi-dnd.c b/src/brasero-multi-dnd.c
index 32f1ec5..7c9b512 100644
--- a/src/brasero-multi-dnd.c
+++ b/src/brasero-multi-dnd.c
@@ -81,6 +81,13 @@ brasero_multi_DND_drag_data_get (EggTreeMultiDragSource *drag_source,
 		gtk_tree_path_free (path);
 
 		uris = gtk_selection_data_get_uris (selection_tmp);
+		if (!uris) {
+			const guchar *selection_data_raw;
+
+			selection_data_raw = gtk_selection_data_get_data (selection_data);
+			uris = g_uri_list_extract_uris ((gchar *) selection_data_raw);
+		}
+
 		for (tmp = uris; tmp && *tmp; tmp++)
 			uris_list = g_list_prepend (uris_list, *tmp);
 		g_free (uris);
diff --git a/src/brasero-video-tree-model.c b/src/brasero-video-tree-model.c
index 68f1b15..5536662 100644
--- a/src/brasero-video-tree-model.c
+++ b/src/brasero-video-tree-model.c
@@ -839,7 +839,7 @@ brasero_video_tree_model_drag_data_received (GtkTreeDragDest *drag_dest,
 
 	/* The new row(s) must be before dest_path but after our sibling */
 	sibling = brasero_video_tree_model_path_to_track (BRASERO_VIDEO_TREE_MODEL (drag_dest), dest_path);
-		
+
 	/* Received data: see where it comes from:
 	 * - from us, then that's a simple move
 	 * - from another widget then it's going to be URIS and we add
@@ -872,16 +872,29 @@ brasero_video_tree_model_drag_data_received (GtkTreeDragDest *drag_dest,
 	}
 	else if (selection_data->target == gdk_atom_intern ("text/uri-list", TRUE)) {
 		gint i;
-		gchar **uris;
+		gchar **uris = NULL;
 		gboolean success = FALSE;
+		const guchar *selection_data_raw;
+
+		/* NOTE: for some reason gdk_text_property_to_utf8_list_for_display ()
+		 * fails with banshee DND URIs list when calling gtk_selection_data_get_uris ().
+		 * so do like nautilus */
 
 		/* NOTE: there can be many URIs at the same time. One
 		 * success is enough to return TRUE. */
-		success = FALSE;
+		selection_data_raw = gtk_selection_data_get_data (selection_data);
 		uris = gtk_selection_data_get_uris (selection_data);
+		if (!uris) {
+			const guchar *selection_data_raw;
+
+			selection_data_raw = gtk_selection_data_get_data (selection_data);
+			uris = g_uri_list_extract_uris ((gchar *) selection_data_raw);
+		}
+
 		if (!uris)
 			return TRUE;
 
+		success = FALSE;
 		for (i = 0; uris [i]; i ++) {
 			BraseroTrackStreamCfg *track;
 



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