<div class="gmail_quote">On Fri, Mar 13, 2009 at 5:51 PM, Hans Meine <span dir="ltr"><<a href="mailto:hans_meine@gmx.net">hans_meine@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Friday 13 March 2009 15:14:33 Aleix Pol wrote:<br>
> > #3) The other response is likely right. I bet the following accesses<br>
> > deleted memory with the Raster engine:<br>
> ><br>
> > const int w = 16, h = 16;<br>
> > QRgb* data = new QRgb[w*h*4];<br>
> > std::memset(data, 0, w*h*4);<br>
> > QImage* i = new QImage(data, w, h, QImage::Format_ARGB32_Premultiplied);<br>
> > QPixmap p = QPixmap::fromImage(*i);<br>
> > delete i;<br>
> > //Do stuff with p here<br>
> ><br>
> > There seems to be no deep copy going on here (and coincidentally,<br>
> > QImage::convertToFormat docs lie --- it doesn't always return a copy)<br>
><br>
> Yes it is possible, but I don't know where this copy happens at all.<br>
<br>
</div>Exactly, Maskim (and I) pointed out that there *is* no copy.<br>
AFAICS, it would be enough to detach the QImage, alas detach() is internal.<br>
How about<br>
<br>
QImage* i = new QImage((const QRgb *)data, w, h, QImage::Format_ARGB32_Premultiplied);<br>
(void)i.bits(); // detach from data<br>
<br>
if the above is the actual code?<br>
<br>
BTW: It probably works with OpenGL for you, because OpenGL is another<br>
client/server system, i.e. the data is copied into an OpenGL-managed<br>
area (possibly even the graphics card's memory).<br>
<br>
HTH,<br>
<font color="#888888">  Hans<br>
<br>
</font></blockquote></div><br>Is there a way to make sure what graphicssystem is being used?<br>I haven't asked for raster at any moment...<br><br>I only want it to work :S<br><br>Plus we should warn the user the usage of raster.<br>
<br>Thanks,<br>Aleix<br>