GNOME Bugzilla – Bug 527549
Crash when trying to insert HTML file...
Last modified: 2009-12-05 04:54:32 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
+ Trace 194944
Thread 1 (Thread 46912584683664 (LWP 16849))
Adding this to my "new composer" tracker (bug #522153).
Milan, I can't seem to reproduce this. Can you? The crash seems to be originating from libgtkhtml, not the composer UI.
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.
Removing this from my tracker since it seems to be in GtkHtml core.
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.
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).
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...
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.
Great, thanks! I'll attempt a patch for this tomorrow.
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.
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 :)
Matt, did you get time to rework on this patch ? :-)
Having gained more experience with GIO, I would never approve that patch now. Reworking it.
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.