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 527549 - Crash when trying to insert HTML file...
Crash when trying to insert HTML file...
Status: RESOLVED FIXED
Product: GtkHtml
Classification: Other
Component: Editing
3.24.x
Other Linux
: Normal normal
: ---
Assigned To: gtkhtml-maintainers
Evolution QA team
evolution[composer]
Depends on:
Blocks: 522153
 
 
Reported: 2008-04-11 14:08 UTC by Milan Crha
Modified: 2009-12-05 04:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed gtkhtml patch (1.75 KB, patch)
2008-04-24 16:54 UTC, Milan Crha
reviewed Details | Review
A different approach (17.14 KB, patch)
2008-04-29 23:07 UTC, Matthew Barnes
needs-work Details | Review

Description Milan Crha 2008-04-11 14:08:13 UTC
I was cheating composer a bit when I was trying to Insert->HTML File and pasted to location this URL: http://i.iinfo.cz/urs/5-120781571130284.jpg

The result of the dialog confirmation was just this crash. On the console was written: gtkhtml-editor-CRITICAL **: gtkhtml_editor_get_file_contents: assertion `filename != NULL' failed

0x00000031fe60e0bf in waitpid () from /lib64/libpthread.so.0

Thread 1 (Thread 46912584683664 (LWP 16849))

  • #0 waitpid
    from /lib64/libpthread.so.0
  • #1 IA__g_spawn_sync
    at gspawn.c line 374
  • #2 IA__g_spawn_command_line_sync
    at gspawn.c line 682
  • #3 bugbuddy_segv_handle
    at gnome-breakpad.cc line 213
  • #4 segv_redirect
    at main.c line 519
  • #5 <signal handler called>
  • #6 html_tokenizer_tokenize_one_char
    at htmltokenizer.c line 1316
  • #7 html_tokenizer_real_write
    at htmltokenizer.c line 1340
  • #8 html_tokenizer_write
    at htmltokenizer.c line 1408
  • #9 html_engine_stream_write
    at htmlengine.c line 4475
  • #10 gtk_html_stream_write
    at gtkhtml-stream.c line 79
  • #11 gtk_html_write
    at gtkhtml.c line 3518
  • #12 insert_html_file_response_cb
    at gtkhtml-editor-actions.c line 202
  • #13 IA__g_cclosure_marshal_VOID__INT
    at gmarshal.c line 216
  • #14 IA__g_closure_invoke
    at gclosure.c line 490
  • #15 signal_emit_unlocked_R
    at gsignal.c line 2440
  • #16 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #17 IA__g_signal_emit
    at gsignal.c line 2243
  • #18 IA__gtk_dialog_response
    at gtkdialog.c line 905
  • #19 action_widget_activated
    at gtkdialog.c line 604
  • #20 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #21 IA__g_closure_invoke
    at gclosure.c line 490
  • #22 signal_emit_unlocked_R
    at gsignal.c line 2440
  • #23 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #24 IA__g_signal_emit
    at gsignal.c line 2243
  • #25 IA__gtk_button_clicked
    at gtkbutton.c line 889
  • #26 gtk_button_finish_activate
    at gtkbutton.c line 1553
  • #27 button_activate_timeout
    at gtkbutton.c line 1493
  • #28 gdk_threads_dispatch
    at gdk.c line 470
  • #29 g_timeout_dispatch
    at gmain.c line 3437
  • #30 g_main_dispatch
    at gmain.c line 2003
  • #31 IA__g_main_context_dispatch
    at gmain.c line 2555
  • #32 g_main_context_iterate
    at gmain.c line 2636
  • #33 IA__g_main_loop_run
    at gmain.c line 2844
  • #34 IA__gtk_dialog_run
    at gtkdialog.c line 1067
  • #35 gtkhtml_editor_file_chooser_dialog_run
    at gtkhtml-editor.c line 1229
  • #36 gtkhtml_editor_insert_file
    at gtkhtml-editor-private.c line 504
  • #37 action_insert_html_file_cb
    at gtkhtml-editor-actions.c line 694
  • #38 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #39 IA__g_closure_invoke
    at gclosure.c line 490
  • #40 signal_emit_unlocked_R
    at gsignal.c line 2440
  • #41 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #42 IA__g_signal_emit
    at gsignal.c line 2243
  • #43 _gtk_action_emit_activate
    at gtkaction.c line 872
  • #44 IA__gtk_action_activate
    at gtkaction.c line 899
  • #45 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #46 IA__g_closure_invoke
    at gclosure.c line 490
  • #47 signal_emit_unlocked_R
    at gsignal.c line 2440
  • #48 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #49 IA__g_signal_emit
    at gsignal.c line 2243
  • #50 IA__gtk_widget_activate
    at gtkwidget.c line 4707
  • #51 IA__gtk_menu_shell_activate_item
    at gtkmenushell.c line 1145
  • #52 gtk_menu_shell_button_release
    at gtkmenushell.c line 669
  • #53 gtk_menu_button_release
    at gtkmenu.c line 2725
  • #54 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 84
  • #55 g_type_class_meta_marshal
    at gclosure.c line 567
  • #56 IA__g_closure_invoke
    at gclosure.c line 490
  • #57 signal_emit_unlocked_R
    at gsignal.c line 2478
  • #58 IA__g_signal_emit_valist
    at gsignal.c line 2209
  • #59 IA__g_signal_emit
    at gsignal.c line 2243
  • #60 gtk_widget_event_internal
    at gtkwidget.c line 4676
  • #61 IA__gtk_widget_event
    at gtkwidget.c line 4476
  • #62 IA__gtk_propagate_event
    at gtkmain.c line 2336
  • #63 IA__gtk_main_do_event
    at gtkmain.c line 1556
  • #64 gdk_event_dispatch
    at gdkevents-x11.c line 2365
  • #65 g_main_dispatch
    at gmain.c line 2003
  • #66 IA__g_main_context_dispatch
    at gmain.c line 2555
  • #67 g_main_context_iterate
    at gmain.c line 2636
  • #68 IA__g_main_loop_run
    at gmain.c line 2844
  • #69 bonobo_main
    at bonobo-main.c line 311
  • #70 main
    at main.c line 782
  • #0 waitpid
    from /lib64/libpthread.so.0

Comment 1 Matthew Barnes 2008-04-11 16:25:18 UTC
Adding this to my "new composer" tracker (bug #522153).
Comment 2 Matthew Barnes 2008-04-15 20:03:17 UTC
Milan, I can't seem to reproduce this.  Can you?

The crash seems to be originating from libgtkhtml, not the composer UI.
Comment 3 Milan Crha 2008-04-16 16:01:09 UTC
Yes, I can reproduce this, maybe exact steps could be better:
a) Open composer (Ctrl+N in mail component) (I'm in plain text format)
b) menu Insert->HTML File...
c) Click on "Type a file name" icon (left-top) in the open dialog
   and paste there the URL from the original post and click Open.
Comment 4 Matthew Barnes 2008-04-22 00:49:36 UTC
Removing this from my tracker since it seems to be in GtkHtml core.
Comment 5 Milan Crha 2008-04-24 16:54:01 UTC
Created attachment 109836 [details] [review]
proposed gtkhtml patch

for gtkhtml;

It will not crash this time, and it reports error in same way as the rest of the function, so should be fine.
Comment 6 Matthew Barnes 2008-04-24 17:52:03 UTC
Okay, so this /is/ a composer issue.  I can reproduce this now but I'm getting a double-free crash, not a backtrace.

*** glibc detected *** /home/mbarnes/bin/evolution: free(): invalid pointer:   0xbf8df4b0 ***
======= Backtrace: =========
/lib/libc.so.6[0xf47ca5]
/lib/libc.so.6(cfree+0x96)[0xf49da6]
/home/mbarnes/lib/libglib-2.0.so.0(g_free+0x35)[0xdfa57f]
/home/mbarnes/lib/libgtkhtml-editor.so.0[0x2f79d7]
...

The CRITICAL warning shows a function argument guard is failing, which indicates a programming error at a deeper level.  Let me take a closer look at this.

Adding this to my "new composer" tracker again (bug #522153).
Comment 7 Matthew Barnes 2008-04-24 18:08:55 UTC
The root problem is my logic is assuming the file chooser dialog selected a local filename.  If it didn't, gtk_file_chooser_get_filename() comes back NULL and that leads to the crash we're seeing.  Would be cool for the composer to actually handle what you were trying to do.

Guess it's time for GtkHTML to enter the brave new world of GIO...
Comment 8 Milan Crha 2008-04-24 18:20:56 UTC
Yup, that's the other approach to fix this, and definitely better. If you wish, there is a synchronous method to download remote files (e_util_read_file).
I believe it's fine without mounting, because that part would be awful to implement in composer.
Comment 9 Matthew Barnes 2008-04-24 18:24:47 UTC
Great, thanks!  I'll attempt a patch for this tomorrow.
Comment 10 Matthew Barnes 2008-04-29 23:07:51 UTC
Created attachment 110135 [details] [review]
A different approach

Well this turned out to be more of a chore than I was expecting, but I wanted to add a cancellation dialog while loading a remote file (like in Nautilus).  It also displays an error dialog if something goes wrong or you attempt to insert something that's not text.  Seems to be pretty stable for me.
Comment 11 Milan Crha 2008-05-27 16:45:55 UTC
Good way, but needs a bit polishing. When I cancel the dialog while downloading, then evo crashes. I was going to insert _text_ file as this url: http://games.tiscali.cz/news/index.html
and hit Esc as soon as the dialog showed up. I noticed runtime warnings on the console:
(evolution:8517): gtkhtml-editor-CRITICAL **: gtkhtml_editor_get_file_contents: assertion `G_IS_ASYNC_RESULT (result)' failed

(evolution:8517): gtkhtml-editor-CRITICAL **: gtkhtml_editor_convert_to_utf8: assertion `text != NULL' failed

But otherwise the code looks fine, even with the XXX comments :)
Comment 12 Akhil Laddha 2009-12-04 05:14:47 UTC
Matt, did you get time to rework on this patch ? :-)
Comment 13 Matthew Barnes 2009-12-05 04:09:20 UTC
Having gained more experience with GIO, I would never approve that patch now.  Reworking it.
Comment 14 Matthew Barnes 2009-12-05 04:54:32 UTC
This should work better:
http://git.gnome.org/cgit/gtkhtml/commit/?id=74ec6ec6c15e7a54d3d1040d4c9259830d1cbc3c

I skipped the cancellation dialog because dialogs suck.  Still working out a good way to track and cancel asynchronous activities in editor windows.