[Qt-interest] Segmentation fault in QPixmap::fromImage()
Cole, Derek
dcole at integrity-apps.com
Thu Apr 7 23:17:27 CEST 2011
Just to update this for other people that may find it. The problem was that the data needed to be 32 bit aligned when creating the QImage. Adding the stride parameter solved the problem.
Derek
-----Original Message-----
From: qt-interest-bounces+dcole=integrity-apps.com at qt.nokia.com on behalf of Cole, Derek
Sent: Fri 4/1/2011 10:22 AM
To: Mandeep Sandhu
Cc: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Segmentation fault in QPixmap::fromImage()
How can I tell what type of application is it?
I think that this should work, because it does work for some images, but not others, which is the weird part
-----Original Message-----
From: Mandeep Sandhu [mailto:mandeepsandhu.chd at gmail.com]
Sent: Thu 3/31/2011 11:30 PM
To: Cole, Derek
Cc: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Segmentation fault in QPixmap::fromImage()
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110407/4a4f9154/attachment.html
More information about the Qt-interest-old
mailing list