[Qt-interest] strange QPixmap::fromImage crash

caius ligarius caius9090 at gmail.com
Thu May 20 00:59:48 CEST 2010


Hi,

I am trying to get a pixmap from a QImage using the fromImage function and
the code crashes  -

QPixmap np = QPixmap::fromImage(qImage)

qimage.cpp-
static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src,
Qt::ImageConversionFlags)
{
....
....
 int w = src->width;
    const uchar *src_data = src->data;
    uchar *dest_data = dest->data;
    for (int y = 0; y < src->height; y++) {
        uint *p = (uint *)dest_data;
        const uchar *b = src_data;
        uint *end = p + w;

        while (p < end)
            *p++ = colorTable.at(*b++); //crash at this line )debugger say b
: bad ptr)
....
....
}

qImage was created using-
QImage* qImage = new QImage(byteData, cols, rows,QImage::Format_Indexed8);

I have verified qImage by dumping this (qImage->bits()) to a file. All
values are b/w 0-255 and am also able to view image correctly by loading
this file in an external image viewer.

What is going wrong here?

Thanks,
Caius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100519/d6e8e4af/attachment.html 


More information about the Qt-interest-old mailing list