Results 1 to 5 of 5

Thread: QWebView SegFault

  1. #1
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Unhappy QWebView SegFault

    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?

    Qt Code:
    1. void mtg::finishedSlot(bool) {
    2. QWebElementCollection elements = ui->webView->page()->mainFrame()->findAllElements("div");
    3. QString HTML("<html><body>");
    4.  
    5. foreach(QWebElement element, elements) {
    6. if(element.attribute("class") == "sr") {
    7. HTML.append(element.toOuterXml());
    8. }
    9. }
    10. HTML += "</body></html>";
    11. ui->webView->setHtml(HTML);
    12.  
    13. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QWebView SegFault

    Which line is causing the crash ?

  3. #3
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWebView SegFault

    Line 11 in that snippet

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QWebView SegFault

    Can you post the stack backtrace ?

  5. #5
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWebView SegFault

    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)

    Qt Code:
    1. Dump of assembler code for function _ZNK11QTextEngine7itemizeEv:
    2. 0x01836c20 <+0>: push %ebp
    3. 0x01836c21 <+1>: mov %esp,%ebp
    4. 0x01836c23 <+3>: push %edi
    5. 0x01836c24 <+4>: push %esi
    6. 0x01836c25 <+5>: push %ebx
    7. 0x01836c26 <+6>: call 0x15afae7
    8. 0x01836c2b <+11>: add $0x6d73c9,%ebx
    9. 0x01836c31 <+17>: sub $0x43cc,%esp
    10. 0x01836c37 <+23>: mov 0x8(%ebp),%eax
    11. 0x01836c3a <+26>: mov %gs:0x14,%edx
    12. 0x01836c41 <+33>: mov %edx,-0x1c(%ebp)
    13. 0x01836c44 <+36>: xor %edx,%edx
    14. [COLOR="yellow"]0x01836c46 <+38>: mov %eax,-0x43a0(%ebp)[/COLOR]
    15. 0x01836c4c <+44>: mov %eax,(%esp)
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 8
    Last Post: 3rd September 2013, 09:51
  2. Segfault openGL
    By qtnewb in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2010, 11:32
  3. Segfault
    By Dumbledore in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 07:31
  4. segfault
    By conexion2000 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2006, 12:34
  5. Why does setTextColor() cause a segfault?
    By johnny_sparx in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2006, 16:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.