On Thu, Mar 09, 2000 at 10:04:48AM +0100, Bertho Stultiens wrote:
> Dimitrie Paun wrote:
> [snip]
> > - bmpImage->data = xcalloc( bmpImage->bytes_per_line * lines );
> > + bmpImage->data = calloc( lines, bmpImage->bytes_per_line );
> > + if(bmpImage->data == NULL) {
> > + WARN("Out of memory!");
> > + XDestroyImage( bmpImage );
> > + return lines;
> > + }
> [etc...]
>
> You should not use malloc and friends at all because they are not
> thread-safe. These functions should map to windows-equivalents. However,
> these functions are, in principle, available in wine, but cannot be
> accessed due to name conflicts with libc. Using the windows/process heap
> would solve these issues.
You have to be careful here though. X assumes that image data is
allocated by malloc and will try to free it in XDestroyImage using
free. In principle we can free any image data ourselves (or define
our own DestroyImage function and hook it into the image function
pointers). We must then not use XGetImage but XGetSubImage instead.
There's also going to be a problem with XListFonts.
Huw.
--
Dr. Huw D M Davies | Clarendon Laboratory
[EMAIL PROTECTED] | Parks Road
Tel: +44 1865 272390 | Oxford OX1 3PU
Fax: +44 1865 272400 | UK