[evolution-patches] gtkhtml: fix crash when inserting "empty" image



Attached patch fixes crash which occurs when inserting HTML source
containing image(s) with url == "".

It's easily reproducible from Insert/Image dialog by pressing Insert
button without any change in dialog values.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1789
diff -u -p -r1.1789 ChangeLog
--- ChangeLog	1 May 2003 20:53:24 -0000	1.1789
+++ ChangeLog	2 May 2003 10:41:23 -0000
@@ -1,3 +1,13 @@
+2003-05-02  Radek Doulik  <rodo ximian com>
+
+	* htmlimage.c (html_image_factory_register): insert ip into loaded
+	images table even if url == "" so we keep track of all ip's. this
+	fixes the crash when inserting html src with image with "" url and
+	also doesn't leak ip's
+
+	* gtkhtml.c (gtk_html_set_default_content_type): remove unused
+	variable
+
 2003-05-01  Larry Ewing  <lewing ximian com>
 
 	* htmlengine.c (html_engine_thaw_idle_flush): actually remove the
Index: gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.506
diff -u -p -r1.506 gtkhtml.c
--- gtkhtml.c	29 Apr 2003 16:02:49 -0000	1.506
+++ gtkhtml.c	2 May 2003 10:41:24 -0000
@@ -3659,8 +3659,6 @@ gtk_html_redo (GtkHTML *html)
 void
 gtk_html_set_default_content_type (GtkHTML *html, gchar *content_type)
 {
-	gchar *lower;
-
 	g_free (html->priv->content_type);	
 
 	if (content_type) {
Index: htmlimage.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlimage.c,v
retrieving revision 1.183
diff -u -p -r1.183 htmlimage.c
--- htmlimage.c	17 Apr 2003 15:10:19 -0000	1.183
+++ htmlimage.c	2 May 2003 10:41:27 -0000
@@ -1325,6 +1325,7 @@ html_image_factory_register (HTMLImageFa
 
 	if (!ip) {
 		ip = html_image_pointer_new (url, factory);
+		g_hash_table_insert (factory->loaded_images, ip->url, ip);
 		if (*url) {
 			g_signal_connect (G_OBJECT (ip->loader), "area_prepared",
 					  G_CALLBACK (html_image_factory_area_prepared),
@@ -1333,8 +1334,6 @@ html_image_factory_register (HTMLImageFa
 			g_signal_connect (G_OBJECT (ip->loader), "area_updated",
 					  G_CALLBACK (html_image_factory_area_updated),
 					  ip);
-
-			g_hash_table_insert (factory->loaded_images, ip->url, ip);
 			stream = html_image_pointer_load (ip);
 		}
 	} else {


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