GNOME Bugzilla – Bug 128784
Yelp crashes using Ctrl+G
Last modified: 2004-12-22 21:47:04 UTC
Overall description: Yelp crashes when users click on 'Ctrl+G' to find the next matching character, while a new html page is loading (or when users clicks on a new link on the side pane to switch to another page). Steps to reproduce: 0) View any online manual, select "Edit->Find in page... (Ctrl+F)", the "Find Text" dialog is displayed, enter a text in the Entry Field, click on the "Find" button to find it, then click on the "Close" button to close the dialog. 1) Click on any links on the side pane to display another section of the manual, select "Find->Find again (Ctrl+G)" or click on "Ctrl+G" to find the next matching character in the new page. Actual Results: The yelp crashes. Expect Result: Yelp display window will highlight the matching text, and scroll the display window to the matching text (or doing nothing if no matching text found). Additional Info: The same problem also happened to yelp 2.2.0 on Redhat 9 Distribution. Possible Caused: I have identified the problem to yelp_html_find (yelp-html-gtkhtml2.c), is it in html_view_find_layout_box or html_box_text_get_text or other? Stack: The stack is generated by running yelp, make it crashes and run gdb to attach to the process.
+ Trace 42411
Appears to be a unique stack trace, according to the simple-dup-finder.
I have identified the problem, but it is good that someone help me verify if that was the real cause: Everytime, a new html page is written to the view, we use the following steps (example, from yelp_html_new): yelp_html_clear (html); { gchar *text = "<html><body></body></html>"; yelp_html_write (html, text, -1); } yelp_html_close (html); * yelp_html_clear will invokes html_document_clear (priv->doc) to clear a doc, then html_document_open_stream (priv->doc, "text/html"); then yelp_html_close to close the stream. however we forget to close the DomNodeIterator (priv->find_iter) that was created from the priv->doc (previous html page) when we invokes html_document_clear to clear a page. So when we load the 1st html, it calls html_document_clear to clear and close priv->doc, then loading a html page to view. after that we use 'Find' to search a text, the we load another html page, this will invoke the html_document_clear to clear and close the priv->doc, then we click on the 'Ctrl+G' to find the next matching text. The cause is here, the DomNodeIterator (priv->find_iter) was NOT set to NULL when we call html_document_clear, so it is still be used to traverse through nodes list of NOT longer exist html page (priv->doc, which has been reset by html_document_clear). Sorry for the long explanation, hopefullly i catch the real bug, thank. The following is the patch for yelp-html-gtkhtml2.c. WARNING: it is generated from gnome-2-4 from CVS. The problem happened in both 2.4 and 2.5 Index: yelp-html-gtkhtml2.c =================================================================== RCS file: /cvs/gnome/yelp/src/yelp-html-gtkhtml2.c,v retrieving revision 1.12 diff -u -r1.12 yelp-html-gtkhtml2.c --- yelp-html-gtkhtml2.c 13 Jun 2003 17:15:00 -0000 1.12 +++ yelp-html-gtkhtml2.c 9 Dec 2003 15:57:03 -0000 @@ -314,7 +314,7 @@ g_return_if_fail (YELP_IS_HTML (html)); priv = html->priv; - + html_clear_find_data (html); html_document_clear (priv->doc); html_document_open_stream (priv->doc, "text/html"); html_stream_set_cancel_func (priv->doc->current_stream,
A patch file for this bug is attached to bug #128905. The single patch file will fix both bugs.
I think there's still a problem here, but I've committed this because it's clearly an improvement. I'm going to leave this bug open until I'm certain.
Sorry, that comment was meant for 128905. This bug's getting closed. Thanks.