[webkit-dev] gdom_x_path_evaluator_create_ns_resolver [was: webkit #16401]

Luke Kenneth Casson Leighton lkcl at lkcl.net
Mon Jun 8 07:55:09 PDT 2009

> Well I tried:
>     GdomXPathResult *res;
>     char* exp = "//html:select";
>     GdomDocument *doc = get_dom_document();
>     GdomNodeList *els = gdom_document_get_elements_by_tag_name(doc,
>  "body");
>     GdomNode *body = gdom_node_list_item(els, 0);
>     GdomXPathNSResolver *resolver =
>  gdom_document_create_ns_resolver(doc, body);
>     g_warning("init completed");
>     gdom_document_evaluate(doc, exp, GDOM_NODE(body), resolver, 0, res);
>  The warning is printed followed by a segfault.
>  gdb told me (relevant parts):
>  #0  0x00007fb6215ea058 in g_type_check_instance_cast () from
>  /usr/lib/libgobject-2.0.so.0
>  #1  0x00007fb623d21cb9 in WebKit::core () from
>  /usr/local/lib/libwebkit-1.0.so.2
>  #2  0x00007fb623cc55ab in gdom_document_evaluate () from
>  /usr/local/lib/libwebkit-1.0.so.2
>  It seems like an argument is broken.

 hmm, i'm guessing it's the uninitialised last argument (from the
g_type_check_instance_cast) but it could equally, athough unlikely, be
the body arg.

 you really need to recompile some of these object files with debug
info. try rm DerivedSources/gdom/*GdomDocument*.lo, do export CXX=gcc
-g -g, re-run configure etc.  that will get you _just_ debug info in
the gdom_document_* functions which will be enough for the purposes
here, without forcing you to recompile absolutely damn everything.

 but yes - try NULL on that last argument (just a guess, here) err
nope, no can do, there - take a look at

GdomXPathResult *
gdom_document_evaluate (GdomDocument *thiz, gchar * expression,
GdomNode * context_node, GdomXPathNSResolver * resolver, gushort type,
GdomXPathResult * in_result)
    WebCore::XPathResult * _g_in_result = WebKit::core(in_result);
    g_return_val_if_fail (_g_in_result, 0);

so - nope, in_result cannot be NULL, and you absolutely must _not_
pass in an uninitialised variable, either.

so - you're going to have to find a GdomXPathResult instance from somewhere.

keep looking around for documentation on this function, i'll do
likewise: if anyone has anything to contribute that can help leon out,
it would be appreciated.


More information about the webkit-dev mailing list