On 6/8/09, Luke Kenneth Casson Leighton <[email protected]> wrote: > > 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 > DerivedSources/gdom/GdomDocument.cpp: > > > 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. >
from a random google search, leading to this: http://www.faqts.com/knowledge_base/view.phtml/aid/34022 a code snippet is this: // test with no prefix doesn't find nodes: var xpathResult = xmlDocument.evaluate( "//element", xmlDocument, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); showing that yes, it should be possible to pass in NULL as that last argument. hmmm, ok, gimme 1 sec, i'll just update CodeGeneratorGObject.pm so it can accept NULL arguments and pass them on... _______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

