Index: gtkhtml/ChangeLog
===================================================================
--- gtkhtml/ChangeLog	(revision 9040)
+++ gtkhtml/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2008-11-04  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #338921
+
+	* htmlimage.c: (html_image_factory_end_pixbuf):
+	Do not crash when the interest in the image left before it was loaded.
+
 2008-10-30  Matthew Barnes  <mbarnes@redhat.com>
 
 	* htmlembedded.c:
Index: gtkhtml/htmlimage.c
===================================================================
--- gtkhtml/htmlimage.c	(revision 9040)
+++ gtkhtml/htmlimage.c	(working copy)
@@ -1120,12 +1120,16 @@ html_image_factory_end_pixbuf (GtkHTMLSt
 	g_object_unref (ip->loader);
 	ip->loader = NULL;
 
-	update_or_redraw (ip);
-	if (ip->factory->engine->opened_streams && ip->factory->engine->block_images)
-		html_engine_opened_streams_decrement (ip->factory->engine);
-	/* printf ("IMAGE(%p) opened streams: %d\n", ip->factory->engine, ip->factory->engine->opened_streams); */
-	if (ip->factory->engine->opened_streams == 0 && ip->factory->engine->block && ip->factory->engine->block_images)
-		html_engine_schedule_update (ip->factory->engine);
+	/* if no ip->factory is set, then the image loading has been cancelled meanwhile, probably. */
+	if (ip->factory) {
+		update_or_redraw (ip);
+		if (ip->factory->engine->opened_streams && ip->factory->engine->block_images)
+			html_engine_opened_streams_decrement (ip->factory->engine);
+		/* printf ("IMAGE(%p) opened streams: %d\n", ip->factory->engine, ip->factory->engine->opened_streams); */
+		if (ip->factory->engine->opened_streams == 0 && ip->factory->engine->block && ip->factory->engine->block_images)
+			html_engine_schedule_update (ip->factory->engine);
+	}
+
 	html_image_pointer_unref (ip);
 }
 
