[taking this discussion onto webkit-dev for the benefit of other people who may wish to use the glib / gobject bindings in the future]
On 6/6/09, Leon Winter <[email protected]> wrote: > Hi, > > @Luke: how is XPath supposed to work? > > GdomXPathResult *res; > GdomXPathEvaluator evaluator; > char *exp = "//html:a"; > 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_x_path_evaluator_create_ns_resolver(&evaluator, body); > > segfaults right at the last line. I found new creation methid for > GdomXPathEvaluator, perhaps there should be one. ok - thanks to mark rowe for highlighting the deliberate mistake: https://bugs.webkit.org/show_bug.cgi?id=16401#c202 the first argument to any of the glib / gobject bindings needs to be the object of the type which matches the IDL class from which the function was auto-generated, so: this function in Document.idl: XPathNSResolver createNSResolver(in Node nodeResolver); results in a function in GdomDocument.h: WEBKIT_API GdomXPathNSResolver * gdom_document_create_ns_resolver (GdomDocument *thiz, GdomNode * node_resolver); so as you can see, you have passed in an (uninitialised!) pointer to "GdomXPathEvaluator evaluator", not a pointer to the GdomDocument object - hence the segfault. try this instead: GdomXPathNSResolver *resolver = gdom_x_path_evaluator_create_ns_resolver(doc, body); l. _______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

