On Thu, 15 Jun 2000, Huw D M Davies wrote:

> On Wed, Jun 14, 2000 at 11:00:21PM +0200, Lionel Ulmer wrote:
> > BTW, by reading the man page for XCreateImage, I found this :
> > 
> >  'Note that when the image is created using XCreateImage, XGetImage,
> >   or XSubImage, the destroy procedure that the XDestroyImage function
> >   calls frees both the image structure and the data pointed to by the
> >   image structure.'
> > 
> > I understand this as saying that calling XDestroyImage on an image
> > created with XCreateImage (our case here) will free itself the image
> > pointer... That would lead to a crash in our case at it would free a
> > HeapAlloc allocated memory block, no ?
> 
> Yes it free()s image->data if it is non-NULL.  So you can either
> HeapFree the image data first and set the pointer to NULL or supply
> your own destroy routine and pointer image->f.destroy_image at it.

As far as I can see, this is already done (line 354 of dsurface/x11.c):

                HeapFree(GetProcessHeap(),0,dspriv->image->data);
                dspriv->image->data = NULL;
                TSXDestroyImage(dspriv->image);

Reply via email to