[webkit-gtk] Help with Webkit crash in application
Avishkar Gupta
avishkar.gupta.delhi at gmail.com
Fri Jul 11 23:08:37 PDT 2014
Hi,
I'm trying to write an application to open epub files with the GTK
framework and webkigtk being my best option I chose to go with it.
I have to provide dual libarary support for both GTK2 and GTK3, and so I
wrote thumbnailer code which uses an offscreen window to render the epub
and get cairo surfaces as screenshots from it. The reason I'm including
that code is because I think that might have something to do with this as
because that's when the problem actually started.
Here is the crash report(segfault) code for the crash, and even though
frame #27 is from my code, that is the call to GTK main, and because of
that from this error report I cannot make out which part of the code is
faulting, so I request you guys to please help me with this.
#0 0x00007ffff0e0851c in WTFCrash () at
../Source/WTF/wtf/Assertions.cpp:333
#1 0x00007ffff0ccd525 in JSC::evaluate (exec=exec at entry=0x7fff8810f9b0,
source=..., thisValue=...,
returnedException=returnedException at entry=0x7fffffffd3a0) at
../Source/JavaScriptCore/runtime/Completion.cpp:65
#2 0x00007ffff51abc88 in evaluate (exception=0x7fffffffd3a0,
thisValue=..., source=..., exec=0x7fff8810f9b0)
at ../Source/WebCore/bindings/js/JSMainThreadExecState.h:62
#3 WebCore::ScriptController::evaluateInWorld (this=this at entry=0x7fff7800a670,
sourceCode=..., world=...)
at ../Source/WebCore/bindings/js/ScriptController.cpp:147
#4 0x00007ffff51abf5c in WebCore::ScriptController::evaluate
(this=0x7fff7800a670, sourceCode=...)
at ../Source/WebCore/bindings/js/ScriptController.cpp:163
#5 0x00007ffff535c025 in WebCore::ScriptElement::executeScript
(this=0x7fffe410d960, sourceCode=...) at
../Source/WebCore/dom/ScriptElement.cpp:310
#6 0x00007ffff535c2f4 in WebCore::ScriptElement::prepareScript
(this=this at entry=0x7fffe410d960, scriptStartPosition=...,
supportLegacyTypes=supportLegacyTypes at entry
=WebCore::ScriptElement::DisallowLegacyTypeInTypeAttribute)
at ../Source/WebCore/dom/ScriptElement.cpp:241
#7 0x00007ffff550670f in WebCore::HTMLScriptRunner::runScript
(this=this at entry=0x7fffe415cae0, script=0x7fffe410d900,
scriptStartPosition=...)
at ../Source/WebCore/html/parser/HTMLScriptRunner.cpp:302
#8 0x00007ffff5506f30 in WebCore::HTMLScriptRunner::execute
(this=0x7fffe415cae0, scriptElement=..., scriptStartPosition=...)
at ../Source/WebCore/html/parser/HTMLScriptRunner.cpp:175
#9 0x00007ffff54ef853 in
WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder (this=this at entry
=0x7fffe415f600)
at ../Source/WebCore/html/parser/HTMLDocumentParser.cpp:218
---Type <return> to continue, or q <return> to quit---
#10 0x00007ffff54ef914 in WebCore::HTMLDocumentParser::canTakeNextToken
(this=this at entry=0x7fffe415f600,
mode=mode at entry=WebCore::HTMLDocumentParser::AllowYield, session=...)
at ../Source/WebCore/html/parser/HTMLDocumentParser.cpp:237
#11 0x00007ffff54f2ce2 in WebCore::HTMLDocumentParser::pumpTokenizer
(this=0x7fffe415f600, mode=WebCore::HTMLDocumentParser::AllowYield)
at ../Source/WebCore/html/parser/HTMLDocumentParser.cpp:293
#12 0x00007ffff54f3992 in WebCore::HTMLDocumentParser::append
(this=0x7fffe415f600, inputSource=...)
at ../Source/WebCore/html/parser/HTMLDocumentParser.cpp:428
#13 0x00007ffff52e869e in WebCore::DecodedDataDocumentParser::appendBytes
(this=0x7fffe415f600, writer=...,
data=0x7fffe4152400 "<html>\n<head>\n<title>Error</title>\n<style
type=\"text/css\">\nbody {\n background-color: #fff;\n margin: 0;\n
padding: 0;\n}\n\n#errorContainer {\n background: #fff;\n min-width:
35em;\n max-width: 35em;\n positio"..., length=975)
at ../Source/WebCore/dom/DecodedDataDocumentParser.cpp:50
#14 0x00007ffff561f594 in WebCore::DocumentLoader::commitData
(this=this at entry=0x7fffe4125b00,
bytes=bytes at entry=0x7fffe4152400
"<html>\n<head>\n<title>Error</title>\n<style type=\"text/css\">\nbody {\n
background-color: #fff;\n margin: 0;\n padding: 0;\n}\n\n#errorContainer
{\n background: #fff;\n min-width: 35em;\n max-width: 35em;\n positio"...,
length=length at entry=975)
at ../Source/WebCore/loader/DocumentLoader.cpp:843
#15 0x00007ffff4ff83f6 in WebKit::FrameLoaderClient::committedLoad
(this=0x7fff78007230, loader=0x7fffe4125b00,
data=0x7fffe4152400 "<html>\n<head>\n<title>Error</title>\n<style
type=\"text/css\">\nbody {\n background-color: #fff;\n margin: 0;\n
padding: 0;\n}\n\n#errorContainer {\n background: #fff;\n min-width:
35em;\n max-width: 35em;\n positio"..., length=975)
at ../Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp:165
#16 0x00007ffff561e08f in WebCore::DocumentLoader::commitLoad
(this=0x7fffe4125b00,
data=0x7fffe4152400 "<html>\n<head>\n<title>Error</title>\n<style
type=\"text/css\">\nbody {\n background-color: #fff;\n margin: 0;\n
padding: 0;\n}\n\n#errorContainer {\n background: #fff;\n min-width:
35em;\n max-width: 35em;\n positio"..., length=975)
at ../Source/WebCore/loader/DocumentLoader.cpp:773
#17 0x00007ffff56212b0 in
WebCore::DocumentLoader::continueAfterContentPolicy (this=this at entry
=0x7fffe4125b00,
policy=policy at entry=WebCore::PolicyUse) at
../Source/WebCore/loader/DocumentLoader.cpp:752
#18 0x00007ffff5624688 in WebCore::DocumentLoader::responseReceived
(this=0x7fffe4125b00, resource=<optimized out>, response=...)
at ../Source/WebCore/loader/DocumentLoader.cpp:655
#19 0x00007ffff561d9ff in
WebCore::DocumentLoader::handleSubstituteDataLoadNow (this=0x7fffe4125b00)
at ../Source/WebCore/loader/DocumentLoader.cpp:475
#20 0x00007ffff50fb1b1 in WebCore::ThreadTimers::sharedTimerFiredInternal
(this=0x7fffe4123f50) at ../Source/WebCore/platform/ThreadTimers.cpp:132
#21 0x00007ffff5110b82 in WebCore::sharedTimerTimeoutCallback () at
../Source/WebCore/platform/gtk/SharedTimerGtk.cpp:49
#22 0x00007ffff3300703 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007ffff32ffce5 in g_main_context_dispatch () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007ffff3300048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff330030a in g_main_loop_run () from
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007ffff46ae447 in IA__gtk_main () at
/build/buildd/gtk+2.0-2.24.23/gtk/gtkmain.c:1271
#27 0x00000000004458d9 in main (argc=1, argv=0x7fffffffe1e8) at
/home/rootavish/BETA/shell/main.c:324
Here is the thumbnailer code I was talking about:
I would really appreciate if somebody could help me with this crash, I
tried asking people on the webkitgtk IRC, but didn't get help. Please I
request you to point out the reason for the crash.
static cairo_surface_t* surface = NULL ;
static gboolean completed = FALSE;
static GdkPixbuf *thumbnail=NULL ;
static void
epub_webkit_render(EpubDocument *document,const char* uri);
//code that calls epub_webkit_render
static GdkPixbuf *
epub_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document,
EvRenderContext *rc,
gboolean border)
{
gchar* uri = (gchar*) rc->page->backend_page;
EpubDocument *epub_document = EPUB_DOCUMENT(document);
completed = FALSE ;
thumbnail=NULL;
if (surface) {
cairo_surface_destroy (surface);
surface=NULL;
}
epub_webkit_render (epub_document,uri);
while (completed != TRUE ) {
/*Wait for the job to complete*/
}
if (thumbnail) {
return thumbnail;
}
else {
return NULL;
}
}
static void
webkit_render_cb(GtkWidget *web_view,
GParamSpec *specification,
gpointer data)
{
WebKitLoadStatus status = webkit_web_view_get_load_status
(WEBKIT_WEB_VIEW(web_view));
if ( status == WEBKIT_LOAD_FINISHED )
{
surface = webkit_web_view_get_snapshot (WEBKIT_WEB_VIEW(web_view));
thumbnail = ev_document_misc_pixbuf_from_surface(surface);
completed=TRUE;
}
}
static void epub_webkit_render(EpubDocument *epub_document,const char* uri)
{
webkit_web_view_load_uri(WEBKIT_WEB_VIEW(epub_document->webview),uri);
}
static WebKitWebView*
offscreen_webview_init()
{
GtkWidget *offscreen_window = gtk_offscreen_window_new();
gtk_window_set_default_size(GTK_WINDOW(offscreen_window),800,600);
GtkWidget* scroll_view = gtk_scrolled_window_new (NULL,NULL);
gtk_scrolled_window_set_policy
(GTK_SCROLLED_WINDOW(scroll_view),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
GtkWidget* web_view = webkit_web_view_new ();
WebKitWebSettings *webviewsettings = webkit_web_settings_new ();
g_object_set (G_OBJECT(webviewsettings), "enable-plugins", FALSE, NULL);
webkit_web_view_set_settings
(WEBKIT_WEB_VIEW(web_view),webviewsettings);
g_signal_connect(WEBKIT_WEB_VIEW(web_view),"notify::load-status",G_CALLBACK(webkit_render_cb),NULL);
gtk_container_add(GTK_CONTAINER(scroll_view),web_view);
gtk_container_add(GTK_CONTAINER(offscreen_window),scroll_view);
gtk_widget_show_all (offscreen_window);
return WEBKIT_WEB_VIEW(web_view);
}
I please request you to help me with my code. I tried searching online but
could not find any conclusive answers.
Regards,
Avishkar Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20140712/0c0e1519/attachment-0001.html>
More information about the webkit-gtk
mailing list