From kde-core-devel Fri Mar 13 19:57:23 2009 From: Aleix Pol Date: Fri, 13 Mar 2009 19:57:23 +0000 To: kde-core-devel Subject: Re: KIO::PreviewJob pixmaps + Qt4.5 crashes Message-Id: <757d9a550903131257j3fd86a6dr9f1956122a9d6ae9 () mail ! gmail ! com> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=123736409829687 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--0016364c720b67f4850465058281" --0016364c720b67f4850465058281 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Fri, Mar 13, 2009 at 5:51 PM, Hans Meine 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, > QImage::Format_ARGB32_Premultiplied); > > > 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, > QImage::Format_ARGB32_Premultiplied); > (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). > > HTH, > Hans > > 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. Thanks, Aleix --0016364c720b67f4850465058281 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Is there a way to make sure what graphicssyst= em 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.

Thanks,
Aleix
--0016364c720b67f4850465058281--