KIO::PreviewJob pixmaps + Qt4.5 crashes
aleixpol at kde.org
Fri Mar 13 19:57:23 GMT 2009
On Fri, Mar 13, 2009 at 5:51 PM, Hans Meine <hans_meine at gmx.net> wrote:
> On Friday 13 March 2009 15:14:33 Aleix Pol wrote:
> > > #3) The other response is likely right. I bet the following accesses
> > > deleted memory with the Raster engine:
> > >
> > > const int w = 16, h = 16;
> > > QRgb* data = new QRgb[w*h*4];
> > > std::memset(data, 0, w*h*4);
> > > QImage* i = new QImage(data, w, h,
> > > QPixmap p = QPixmap::fromImage(*i);
> > > delete i;
> > > //Do stuff with p here
> > >
> > > There seems to be no deep copy going on here (and coincidentally,
> > > QImage::convertToFormat docs lie --- it doesn't always return a copy)
> > Yes it is possible, but I don't know where this copy happens at all.
> Exactly, Maskim (and I) pointed out that there *is* no copy.
> AFAICS, it would be enough to detach the QImage, alas detach() is internal.
> How about
> QImage* i = new QImage((const QRgb *)data, w, h,
> (void)i.bits(); // detach from data
> if the above is the actual code?
> BTW: It probably works with OpenGL for you, because OpenGL is another
> client/server system, i.e. the data is copied into an OpenGL-managed
> area (possibly even the graphics card's memory).
Is there a way to make sure what graphicssystem is being used?
I haven't asked for raster at any moment...
I only want it to work :S
Plus we should warn the user the usage of raster.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the kde-core-devel