Re: [evolution-patches] Please review my patch for bug #47131



Hello Not Zed
Thanks for you review my patch, I have created a new patch according your advice, Could you reivew it again?

Regards,
Anto
Not Zed wrote:

This logic needs cleaning, and leads to a memory leak in the non-file
url case:

+
+                               if (!strcasecmp (url->protocol,
"file")) {
+                                       filename = url->path;
+
+                                       e_msg_composer_attachment_bar_attach
+                                               (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
+                                               filename);
+
+                                       g_free (filename);
+                               }
                               url->path = NULL;
                               camel_url_free (url);
-

remove the url->path = NULL, and the filename variable entirely, and
just use url->path in :bar_attach().



_______________________________________________
Evolution-patches mailing list
Evolution-patches lists ximian com
http://lists.ximian.com/mailman/listinfo/evolution-patches


Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.544.2.8
diff -u -r1.544.2.8 ChangeLog
--- composer/ChangeLog	29 Jul 2003 15:38:08 -0000	1.544.2.8
+++ composer/ChangeLog	31 Jul 2003 04:27:31 -0000
@@ -1,3 +1,9 @@
+2003-07-31  Antonio Xu  <antonio xu sun com>
+
+	* e-msg-composer.c (drag_data_received): add the drop type of
+	mozilla browser link to make composer support to handle mozilla
+	DnD data.  [#47131]
+
 2003-07-28  Antonio Xu <antonio xu sun com>
 
        * e-msg-composer-attachment-bar.c  (update): add
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.395.2.4
diff -u -r1.395.2.4 e-msg-composer.c
--- composer/e-msg-composer.c	23 Jul 2003 18:17:20 -0000	1.395.2.4
+++ composer/e-msg-composer.c	1 Aug 2003 09:07:32 -0000
@@ -121,12 +121,14 @@
 enum {
 	DND_TYPE_MESSAGE_RFC822,
 	DND_TYPE_TEXT_URI_LIST,
+	DND_TYPE_NETSCAPE_URL,
 	DND_TYPE_TEXT_VCARD,
 };
 
 static GtkTargetEntry drop_types[] = {
 	{ "message/rfc822", 0, DND_TYPE_MESSAGE_RFC822 },
 	{ "text/uri-list", 0, DND_TYPE_TEXT_URI_LIST },
+	{ "_NETSCAPE_URL", 0, DND_TYPE_NETSCAPE_URL },
 	{ "text/x-vcard", 0, DND_TYPE_TEXT_VCARD },
 };
 
@@ -2550,7 +2552,7 @@
 		    int x, int y, GtkSelectionData *selection,
 		    guint info, guint time)
 {
-	char *tmp, *str, *filename, **urls;
+	char *tmp, *str, **urls;
 	CamelMimePart *mime_part;
 	CamelStream *stream;
 	CamelURL *url;
@@ -2568,6 +2570,7 @@
 		camel_object_unref (stream);
 		break;
 	case DND_TYPE_TEXT_URI_LIST:
+	case DND_TYPE_NETSCAPE_URL:
 		d(printf ("dropping a text/uri-list\n"));
 		tmp = g_strndup (selection->data, selection->length);
 		urls = g_strsplit (tmp, "\n", 0);
@@ -2585,16 +2588,13 @@
 
 				if (url == NULL)
 					continue;
-				
-				filename = url->path;
-				url->path = NULL;
+
+				if (!strcasecmp (url->protocol, "file"))
+					e_msg_composer_attachment_bar_attach
+						(E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
+					 	url->path);
+
 				camel_url_free (url);
-				
-				e_msg_composer_attachment_bar_attach
-					(E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
-					 filename);
-				
-				g_free (filename);
 			}
 		}
 		


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