[Qt-interest] QPainter segmentation fault on Linux
Srdjan Todorovic
todorovic.s at googlemail.com
Thu Feb 19 18:10:45 CET 2009
Hi,
2009/2/19 Alexandre Beraud <aberaud at infflux.com>:
> I think it is quite a weird way of doing it but it seems correct. It
> just replaces the allocated data with a new value.
Seems a bit dangerous, doesn't it?
> The risk being that, since you don't call the class destructor on the
> previous object, some internal pointers don't get deleted and will
> result in memory leaks.
Yes you will get memory leaks.
So he's using the assign operator and dereferencing the pointer. I
didn't spot that initially.
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?
Srdjan
More information about the Qt-interest-old
mailing list