PDA

View Full Version : Error : qt_pixmapFromWinHBITMAP, failed create image of 1280x720



tomer.vinay86
14th April 2016, 17:34
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);
QPainter painter(&image);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::TextAntialiasing, true);
painter.setRenderHint(QPainter::SmoothPixmapTransf orm, true);
frame->documentElement().render(&painter);
painter.end();

captureImage.push_back(image);
}

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?

d_stranz
14th April 2016, 21:57
Looks to me like your app crashed because it ran out of memory after storing too many big images. Each of your images is at least 3.5 MB. If you are saving one every second, after 2 - 3 minutes, that's 400 - 600 MB, and I think you are probably storing them faster than that, right?

anda_skoa
15th April 2016, 10:19
and I use the other thread to popup the Qlist data.

If you are accessing captureImage from both threads, you need to protect against concurrent access.

Cheers,
_

tomer.vinay86
15th April 2016, 14:17
Thanks for reply. issue is resolved

d_stranz
15th April 2016, 15:39
Well, certainly don't tell anyone here how you resolved it. Someone might learn something useful to them.