PDA

View Full Version : QWebView SegFault



Decessus
30th July 2011, 04:35
I am having a bit of a problem when trying to use QWebView->setHtml(), the below code is just the snippet of my code that actually uses the function, but it doesn't seem to matter what I have the HTML string set as, it always results in a segfault, any ideas on why and how to fix the issue?



void mtg::finishedSlot(bool) {
QWebElementCollection elements = ui->webView->page()->mainFrame()->findAllElements("div");
QString HTML("<html><body>");

foreach(QWebElement element, elements) {
if(element.attribute("class") == "sr") {
HTML.append(element.toOuterXml());
}
}
HTML += "</body></html>";
ui->webView->setHtml(HTML);

}

stampede
30th July 2011, 09:40
Which line is causing the crash ?

Decessus
30th July 2011, 10:00
Line 11 in that snippet

stampede
30th July 2011, 10:14
Can you post the stack backtrace ?

Decessus
30th July 2011, 22:15
Well, I ended up creating a work around by creating a cache file with the HTML, now the only issue is that there seems to be a script or flash object on the page causing the page to reload which initiates the parsing of the elements again.

For the setHtml() function it seems to be segfaulting at QTextEngine::itemize() (I could be wrong in this)



Dump of assembler code for function _ZNK11QTextEngine7itemizeEv:
0x01836c20 <+0>: push %ebp
0x01836c21 <+1>: mov %esp,%ebp
0x01836c23 <+3>: push %edi
0x01836c24 <+4>: push %esi
0x01836c25 <+5>: push %ebx
0x01836c26 <+6>: call 0x15afae7
0x01836c2b <+11>: add $0x6d73c9,%ebx
0x01836c31 <+17>: sub $0x43cc,%esp
0x01836c37 <+23>: mov 0x8(%ebp),%eax
0x01836c3a <+26>: mov %gs:0x14,%edx
0x01836c41 <+33>: mov %edx,-0x1c(%ebp)
0x01836c44 <+36>: xor %edx,%edx
0x01836c46 <+38>: mov %eax,-0x43a0(%ebp)
0x01836c4c <+44>: mov %eax,(%esp)