I am working on multi threading : one thread is capturing the QImage of QWebView as QWebFrame :
void XXXXX::SaveImage(QWebFrame *frame)
{
QImage image
(frame
->contentsSize
(),
QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent);
painter.
setRenderHint(QPainter::Antialiasing,
true);
painter.
setRenderHint(QPainter::TextAntialiasing,
true);
painter.
setRenderHint(QPainter::SmoothPixmapTransform,
true);
frame->documentElement().render(&painter);
painter.end();
captureImage.push_back(image);
}
void XXXXX::SaveImage(QWebFrame *frame)
{
QImage image(frame->contentsSize(), QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent);
QPainter painter(&image);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::TextAntialiasing, true);
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
frame->documentElement().render(&painter);
painter.end();
captureImage.push_back(image);
}
To copy to clipboard, switch view to plain text mode
and I use the other thread to popup the Qlist data.
But after 2-3 minutes, my application crashes with the below errors.
qt_pixmapFromWinHBITMAP, failed create image of 1280x720
QWaitCondition: Destroyed while threads are still waiting terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc LEAK: 6 RenderObject LEAK: 1 Page LEAK: 1 Frame LEAK: 2 CachedResource LEAK: 28 WebCoreNode
Anyone have an idea why this error is coming?
Bookmarks