QPainter hanging when taking webpage snapshot



  • Hi All,

    We're using the following code to take a screenshot of a webpage:

    @ QWebPage * page = mBrowser.page();
    QImage screenshot(page->viewportSize(), QImage::Format_ARGB32);
    QPainter paint(&screenshot);
    page->currentFrame()->render(&paint);
    paint.end();
    screenshot.save("screenshot.png");@

    However, quite frequently, this block of code hangs. Using gdb, I've done a backtrace as follows. Does anyone have any clues as to why this may be occurring? Some sites this is occurring on include http://wordpress.tv/ and http://octodex.github.com

    @Program received signal SIGINT, Interrupt.
    qt_memfill32_sse2 (dest=0x7fffffff9650, value=4294967295, count=1280) at painting/qdrawhelper_sse2.cpp:269
    269 case 0: do { _mm_stream_si128(dst128++, value128);
    (gdb) up
    #1 0x00007ffff52b92d8 in blend_color_generic (count=206, spans=<value optimized out>, userData=0x112e6e0)
    at painting/qdrawhelper.cpp:3446
    3446 op.funcSolid(dest, l, data->solid.color, spans->coverage);
    (gdb) up
    #2 0x00007ffff525dff7 in flushSpans (this=0xa4f7e0, a=<value optimized out>, b=<value optimized out>,
    width=<value optimized out>, squareCap=<value optimized out>) at painting/qrasterizer.cpp:111
    111 m_blend(m_spanCount, m_spans, m_data);
    (gdb) up
    #3 addSpan (this=0xa4f7e0, a=<value optimized out>, b=<value optimized out>, width=<value optimized out>,
    squareCap=<value optimized out>) at painting/qrasterizer.cpp:105
    105 flushSpans();
    (gdb) up
    #4 QRasterizer::rasterizeLine (this=0xa4f7e0, a=<value optimized out>, b=<value optimized out>,
    width=<value optimized out>, squareCap=<value optimized out>) at painting/qrasterizer.cpp:882
    882 Q16Dot16ToInt(Q16Dot16Multiply(rowHeight, coverage[i])));
    (gdb) down
    #3 addSpan (this=0xa4f7e0, a=<value optimized out>, b=<value optimized out>, width=<value optimized out>,
    squareCap=<value optimized out>) at painting/qrasterizer.cpp:105
    105 flushSpans();
    (gdb) up
    #4 QRasterizer::rasterizeLine (this=0xa4f7e0, a=<value optimized out>, b=<value optimized out>,
    width=<value optimized out>, squareCap=<value optimized out>) at painting/qrasterizer.cpp:882
    882 Q16Dot16ToInt(Q16Dot16Multiply(rowHeight, coverage[i])));
    (gdb) up
    #5 0x00007ffff529877e in QRasterPaintEngine::fillRect (this=0x139c6f0, r=..., data=0x112e6e0)
    at painting/qpaintengine_raster.cpp:1899
    1899 d->rasterizer->rasterizeLine(a, b, nr.height() / nr.width());
    (gdb) up
    #6 0x00007ffff5221037 in QPainter::fillRect (this=0x7fffffffcb50, r=..., brush=...)
    at painting/qpainter.cpp:6961
    6961 d->extended->fillRect(r, brush);
    (gdb) up
    #7 0x00007ffff67c6aab in ?? () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #8 0x00007ffff678b7cc in ?? () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #9 0x00007ffff66f3b11 in ?? () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #10 0x00007ffff6746880 in ?? () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #11 0x00007ffff6747414 in ?? () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #12 0x00007ffff663c17e in ?? () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #13 0x00007ffff6811c46 in ?? () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #14 0x00007ffff6811e76 in QWebFrame::render(QPainter*) () from /usr/lib64/libQtWebKit.so.4
    (gdb) up
    #15 0x0000000000411c20 in bricolage::WebCrawler::takeScreenshot (this=0x7fffffffe0f0)
    at /data/bricolage/Code/Applications/Database/WebCrawlerCPP/src/WebCrawler.cpp:231
    231 page->currentFrame()->render(&paint);@



  • Have tested http://wordpress.tv/ and http://octodex.github.com with my thumb-crawler on Linux x86_64 with Qt 4.7.1 & 4.8.2, no problem at all...

    Are you using ubuntu? have you compiled Qt by yourself or is it default SDK installation?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.