Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.1
-
None
-
Qt 4.8.1, Win7 64bit, 2GB RAM, AMD CPU
-
c44d7eedfdfa80598c877bd2a708a8f126c25fc4
Description
This code produces a segfault:
QPixmap pixmap = QPixmap::fromImage(image);
where image is quite large, has an alpha channel and my memory is already pretty used up.
I tracked the error through
qpixmap.cpp line 2088: data->fromImage(image, flags);
qpixmap_raster.cpp line 156: createPixmapForImage(image, flags, /* inplace = */false);
qpixmap_raster.cpp line 459: sourceImage.d->format = QImage::Format_RGB32;
And the the segfault occurs, because sourceImage.d is null.
What happens is that the detaching (in line 458) tries to copy the image to get rid of the alpha channel, but on my machine there is not enough memory for that. As result, the image is null after detaching. This case is not checked/catched in QRasterPixmapData::createPixmapForImage().
I'm not sure if conversion should happen in place to avoid this situation, or if this error actually can happen im low memory condition and therefore should be catched.
Greetings,
Gregor
Attachments
Issue Links
- relates to
-
QTBUG-67465 QPixmap::fromImage(largeImage) QImage: out of memory, returning null image
- Closed