[Qt-interest] Segmentation fault in QPixmap::fromImage()

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Fri Apr 1 05:30:38 CEST 2011


On Fri, Apr 1, 2011 at 4:06 AM, Cole, Derek <dcole at integrity-apps.com> wrote:
> Hello, I am getting a segmentation fault at the last line of this snippet.
>
>
>      QImage qi(lutData, imwidth,imheight, QImage::Format_Indexed8);
>
> /*...some code to call qi.setColor() to populate the LUT..*/
>
>     QPixmap p(QPixmap::fromImage(qi,Qt::AutoColor));
>
> What could be the cause of this? My program just simply "unexpectedly
> finishes" and the debugger shows it down in the QPixmap lib somewhere..but I
> cant see it obviously

Is this a QApplication or a QCoreApplication? One needs an instance of
QApp to initialize the GUI subsystem.

I had a similar issue when trying to create a pixmap of data read from
a n/w interface while i was using only a QCoreApplication. Not usre if
the same applies to you.

-mandep

>
> Thanks
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>



More information about the Qt-interest-old mailing list