[webkit-dev] Problems with using XPath functionality to query DOM

Alexey Proskuryakov ap at webkit.org
Thu Feb 18 09:38:31 PST 2010

Your question is not about WebKit development, so it should be  
directed to webkit-help mailing list. I've answered below, but please  
choose a correct e-mail list in the future.

Please note that linking directly to WebCore is most definitely  
unsupported and extremely fragile. One should always be using platform- 
specific WebKit APIs.

On 17.02.2010, at 18:27, Steve Hanna wrote:

> 136     WebCore::XPathResult* xpr = doc->evaluate(query,
> dynamic_cast<WebCore::Node*>(doc), NULL,

The XPathResult object is destroyed at this point, so the rest of the  
code operates on freed memory. One needs to keep the reference in  
RefPtr. Also, you don't need dynamic_cast when downcasting - and we  
build WebCore with RTTI disabled anyway.

RefPtr<WebCore::XPathResult> xpr = doc->evaluate(query, doc, 0,  

- WBR, Alexey Proskuryakov

More information about the webkit-dev mailing list