[Qt-interest] QPainter segmentation fault on Linux
Christoph Bartoschek
bartoschek at gmx.de
Fri Feb 20 17:12:43 CET 2009
Davide wrote:
> On Thu, Feb 19, 2009 at 6:10 PM, Srdjan Todorovic
> <todorovic.s at googlemail.com> wrote:
>> I'd say it's still a bad idea, probably a bad design approach. Wont it
>> be better to just keep a pointer member and then alloc your QImage
>> where you assign it?
>
> First of all thanks for your hints, I changed my program in the way
> you suggest me.
>
> Unfortunately my problems on a Linux system still remain.
> Does anybody have an idea of what can cause a Segmentation Fault error
> when I call drawRect method only on a Linux system and not in Windows?
>
> This is my code:
> qImage = new QImage((u8*)Image.data, Image.width, Image.height,
> QImage::Format_RGB32);
> QPainter p;
> p.begin(qImage);
> p.setPen((Qt::GlobalColor)(Qt::cyan));
> p.drawRect(2, 2, 20, 20); // --> Segmentation Fault
> p.end();
>
> Thanks
Run your program with valgrind. Compile a debug version and then just run:
valgrind your_prog
Then you will see what you do wrong.
Christoph
More information about the Qt-interest-old
mailing list