Bug#271137: libgtkhtml2-0: crash when click some link in gnochm

Carlos Z.F. Liu "Carlos Z.F. Liu" <carlos_liu@yahoo.com>, 271137@bugs.debian.org
Sun, 12 Sep 2004 02:17:36 +1200


This is a multi-part MIME message sent by reportbug.

--===============0271174264==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: libgtkhtml2-0
Version: 2.4.1-1
Severity: normal
Tags: patch

Hello,

This is a bug reported to upstream, and it was fixed already. The bug
cause gnochm (a CHM viewer for GNOME) crash frequently.

Upstream Bugreport: http://bugzilla.gnome.org/show_bug.cgi?id=135489


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=zh_CN.UTF-8

Versions of packages libgtkhtml2-0 depends on:
ii  libart-2.0-2                2.3.16-6     Library of functions for 2D graphi
ii  libatk1.0-0                 1.6.1-3      The ATK accessibility toolkit
ii  libc6                       2.3.2.ds1-16 GNU C Library: Shared libraries an
ii  libgail-common              1.6.6b-1     GNOME Accessibility Implementation
ii  libgail17                   1.6.6b-1     GNOME Accessibility Implementation
ii  libglib2.0-0                2.4.6-2      The GLib library of C routines
ii  libgnomecanvas2-0           2.6.1.1-2    A powerful object-oriented display
ii  libgtk2.0-0                 2.4.9-1      The GTK+ graphical user interface 
ii  libpango1.0-0               1.4.1-2      Layout and rendering of internatio
ii  libxml2                     2.6.11-3     GNOME XML library
ii  zlib1g                      1:1.2.1.1-7  compression library - runtime

-- no debconf information

--===============0271174264==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gnochm.patch"

diff -Naur libgtkhtml2-2.4.1.orig/libgtkhtml/document/htmldocument.c libgtkhtml2-2.4.1/libgtkhtml/document/htmldocument.c
--- libgtkhtml2-2.4.1.orig/libgtkhtml/document/htmldocument.c	2003-08-13 21:46:53.000000000 +1200
+++ libgtkhtml2-2.4.1/libgtkhtml/document/htmldocument.c	2004-09-12 02:04:18.000000000 +1200
@@ -664,6 +664,7 @@
 	g_return_val_if_fail (HTML_IS_DOCUMENT (document), FALSE);
 	g_return_val_if_fail (mime_type != NULL, FALSE);
 
+	html_document_clear (document);
 	if (strcasecmp (mime_type, "text/html") == 0) {
 		if (document->parser)
 			g_object_unref (document->parser);
diff -Naur libgtkhtml2-2.4.1.orig/libgtkhtml/document/htmlparser.c libgtkhtml2-2.4.1/libgtkhtml/document/htmlparser.c
--- libgtkhtml2-2.4.1.orig/libgtkhtml/document/htmlparser.c	2003-10-03 01:26:02.000000000 +1200
+++ libgtkhtml2-2.4.1/libgtkhtml/document/htmlparser.c	2004-09-12 02:04:15.000000000 +1200
@@ -96,6 +96,9 @@
 	
 	startDocument (parser->xmlctxt);
 
+	if (parser->document->dom_document) {
+		g_warning ("DomDocument leaked in html_startDocument");
+	}
 	parser->document->dom_document = DOM_DOCUMENT (dom_Node_mkref ((xmlNode *)parser->xmlctxt->myDoc));
 
 	/* Emit document node parsed signal */
diff -Naur libgtkhtml2-2.4.1.orig/libgtkhtml/view/htmlview.c libgtkhtml2-2.4.1/libgtkhtml/view/htmlview.c
--- libgtkhtml2-2.4.1.orig/libgtkhtml/view/htmlview.c	2003-10-03 01:26:02.000000000 +1200
+++ libgtkhtml2-2.4.1/libgtkhtml/view/htmlview.c	2004-09-12 02:04:28.000000000 +1200
@@ -369,8 +369,10 @@
 		}
 		if (parent_box == NULL) {
 			html_view_layout_tree_free (view, view->root);
-			if (view->document && view->document->focus_element)
-				html_document_update_focus_element (view->document, NULL);
+			if (view->document && view->document->focus_element) {
+				g_warning ("Focus element set when inserting toplevel node");
+				view->document->focus_element = NULL;
+			}
 			view->root = new_box;
 		 } else {
 			html_box_append_child (parent_box, new_box);

--===============0271174264==--