After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 128784 - Yelp crashes using Ctrl+G
Yelp crashes using Ctrl+G
Status: RESOLVED FIXED
Product: yelp
Classification: Applications
Component: General
git master
Other Linux
: High critical
: ---
Assigned To: Shaun McCance
Yelp maintainers
Depends on:
Blocks:
 
 
Reported: 2003-12-08 05:23 UTC by Chee Bin HOH
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Chee Bin HOH 2003-12-08 05:23:40 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.

  • #0 wait4
    from /lib/i686/libc.so.6
  • #1 __DTOR_END__
    from /lib/i686/libc.so.6
  • #2 waitpid
    from /lib/i686/libpthread.so.0
  • #3 libgnomeui_segv_handle
    at gnome-ui-init.c line 738
  • #4 __pthread_sighandler
    from /lib/i686/libpthread.so.0
  • #5 <signal handler called>
  • #6 memcpy
    from /lib/i686/libc.so.6
  • #7 yelp_html_find
    at yelp-html-gtkhtml2.c line 487
  • #8 window_find_again_cb
    at yelp-window.c line 1238
  • #9 gtk_item_factory_callback_marshal
    at gtkitemfactory.c line 240
  • #10 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #11 g_closure_invoke
    at gclosure.c line 437
  • #12 signal_emit_unlocked_R
    at gsignal.c line 2436
  • #13 g_signal_emit_valist
    at gsignal.c line 2195
  • #14 g_signal_emit
    at gsignal.c line 2239
  • #15 closure_accel_activate
    at gtkwidget.c line 2934
  • #16 g_closure_invoke
    at gclosure.c line 437
  • #17 signal_emit_unlocked_R
    at gsignal.c line 2436
  • #18 g_signal_emit_valist
    at gsignal.c line 2205
  • #19 g_signal_emit
    at gsignal.c line 2239
  • #20 gtk_accel_group_activate
    at gtkaccelgroup.c line 735
  • #21 gtk_accel_groups_activate
    at gtkaccelgroup.c line 773
  • #22 _gtk_window_activate_key
    at gtkwindow.c line 7031
  • #23 gtk_window_key_press_event
    at gtkwindow.c line 4117
  • #24 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 82
  • #25 g_type_class_meta_marshal
    at gclosure.c line 514
  • #26 g_closure_invoke
    at gclosure.c line 437
  • #27 signal_emit_unlocked_R
    at gsignal.c line 2474
  • #28 g_signal_emit_valist
    at gsignal.c line 2205
  • #29 g_signal_emit
    at gsignal.c line 2239
  • #30 gtk_widget_event_internal
    at gtkwidget.c line 3515
  • #31 gtk_propagate_event
    at gtkmain.c line 2301
  • #32 gtk_main_do_event
    at gtkmain.c line 1568
  • #33 gdk_event_dispatch
    at gdkevents-x11.c line 2094
  • #34 g_main_dispatch
    at gmain.c line 1752
  • #35 g_main_context_dispatch
    at gmain.c line 2300
  • #36 g_main_context_iterate
    at gmain.c line 2381
  • #37 g_main_loop_run
    at gmain.c line 2601
  • #38 bonobo_main
    at bonobo-main.c line 297
  • #39 main
    at yelp-main.c line 381
  • #40 __libc_start_main
    from /lib/i686/libc.so.6

Comment 1 Elijah Newren 2003-12-08 21:05:09 UTC
Appears to be a unique stack trace, according to the simple-dup-finder.
Comment 2 Chee Bin HOH 2003-12-09 16:20:18 UTC
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,
Comment 3 Chee Bin HOH 2003-12-12 14:24:52 UTC
A patch file for this bug is attached to bug #128905.

The single patch file will fix both bugs.


Comment 4 Shaun McCance 2003-12-12 23:50:14 UTC
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.
Comment 5 Shaun McCance 2003-12-12 23:52:02 UTC
Sorry, that comment was meant for 128905.  This bug's getting closed.
 Thanks.