XImage *tempImage;
#ifdef USE_XSHM
- int shm;
+ boolean shm; /** Is this a shared memory buffer? */
XShmSegmentInfo shminfo;
#endif
};
&b->shminfo,
width, height);
if (b->tempImage == NULL) {
- b->shm = 0;
+ b->shm = FALSE;
return;
}
mesaXErrorFlag = 0;
XDestroyImage(b->tempImage);
b->tempImage = NULL;
- b->shm = 0;
+ b->shm = FALSE;
(void) XSetErrorHandler(old_handler);
return;
}
- b->shm = 1;
+ b->shm = TRUE;
}
#endif /* USE_XSHM */
oldBuf->shminfo.shmaddr = (char *) -1;
}
+ if (oldBuf->shm) {
+ oldBuf->data = NULL;
+ }
+
if (oldBuf->tempImage) {
- if (oldBuf->data == oldBuf->tempImage->data) {
- /* oldBuf->data points at the xshm memory which we'll now free */
- oldBuf->data = NULL;
- }
XDestroyImage(oldBuf->tempImage);
+ oldBuf->tempImage = NULL;
}
#endif
buffer->base.usage = usage;
buffer->base.size = size;
- if (buffer->data == NULL) {
- /* align to 16-byte multiple for Cell */
- buffer->data = align_malloc(size, max(alignment, 16));
- }
+ /* align to 16-byte multiple for Cell */
+ buffer->data = align_malloc(size, max(alignment, 16));
return &buffer->base;
}