summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-12-02 20:42:48 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-12-02 20:42:48 +0000
commiteccccc89402e957424312d21e145670d9da0258e (patch)
tree8b8cfefe0898e2502f56b29d67dd25df21f8a0d4
parentfcb01c71276bcb079f8b3b55268a5a28afec48bf (diff)
Fix two failures encountered when running out of memory during XImage
allocation. Append \n to _mesa_warning() strings.
-rw-r--r--src/mesa/drivers/x11/xm_api.c30
-rw-r--r--src/mesa/drivers/x11/xm_buffer.c5
2 files changed, 19 insertions, 16 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 6ed2be5647..37b348fcba 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.4.2
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -532,7 +532,7 @@ alloc_shm_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
ZPixmap, NULL, &b->shminfo,
width, height);
if (b->backxrb->ximage == NULL) {
- _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (XShmCreateImage), disabling.");
+ _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (XShmCreateImage), disabling.\n");
b->shm = 0;
return GL_FALSE;
}
@@ -540,10 +540,10 @@ alloc_shm_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
b->shminfo.shmid = shmget( IPC_PRIVATE, b->backxrb->ximage->bytes_per_line
* b->backxrb->ximage->height, IPC_CREAT|0777 );
if (b->shminfo.shmid < 0) {
- _mesa_warning(NULL, "shmget failed while allocating back buffer");
+ _mesa_warning(NULL, "shmget failed while allocating back buffer.\n");
XDestroyImage( b->backxrb->ximage );
b->backxrb->ximage = NULL;
- _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmget), disabling.");
+ _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmget), disabling.\n");
b->shm = 0;
return GL_FALSE;
}
@@ -551,11 +551,11 @@ alloc_shm_back_buffer(XMesaBuffer b, GLuint width, GLuint height)
b->shminfo.shmaddr = b->backxrb->ximage->data
= (char*)shmat( b->shminfo.shmid, 0, 0 );
if (b->shminfo.shmaddr == (char *) -1) {
- _mesa_warning(NULL, "shmat() failed while allocating back buffer");
+ _mesa_warning(NULL, "shmat() failed while allocating back buffer.\n");
XDestroyImage( b->backxrb->ximage );
shmctl( b->shminfo.shmid, IPC_RMID, 0 );
b->backxrb->ximage = NULL;
- _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmat), disabling.");
+ _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmat), disabling.\n");
b->shm = 0;
return GL_FALSE;
}
@@ -654,20 +654,22 @@ xmesa_alloc_back_buffer( XMesaBuffer b, GLuint width, GLuint height )
8, 0 ); /* pad, bytes_per_line */
#endif
if (!b->backxrb->ximage) {
- _mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed.");
+ _mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed.\n");
}
b->backxrb->ximage->data = (char *) MALLOC( b->backxrb->ximage->height
* b->backxrb->ximage->bytes_per_line );
if (!b->backxrb->ximage->data) {
- _mesa_warning(NULL, "alloc_back_buffer: MALLOC failed.");
+ _mesa_warning(NULL, "alloc_back_buffer: MALLOC failed.\n");
XMesaDestroyImage( b->backxrb->ximage );
b->backxrb->ximage = NULL;
}
- /* this call just updates the width/origin fields in the xrb */
- b->backxrb->Base.AllocStorage(NULL, &b->backxrb->Base,
- b->backxrb->Base.InternalFormat,
- b->backxrb->ximage->width,
- b->backxrb->ximage->height);
+ else {
+ /* this call just updates the width/origin fields in the xrb */
+ b->backxrb->Base.AllocStorage(NULL, &b->backxrb->Base,
+ b->backxrb->Base.InternalFormat,
+ b->backxrb->ximage->width,
+ b->backxrb->ximage->height);
+ }
}
b->backxrb->pixmap = None;
}
@@ -1274,7 +1276,7 @@ static GLboolean initialize_visual_and_buffer( int client,
}
}
else {
- _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.");
+ _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.\n");
return GL_FALSE;
}
v->mesa_visual.indexBits = 0;
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index 593ac2bb19..11d499596f 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.4.2
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -70,7 +70,8 @@ xmesa_alloc_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
xrb->origin4 = (GLuint *) xrb->ximage->data + xrb->width4 * (height - 1);
}
else {
- assert(xrb->pixmap);
+ /* this assertion will fail if we happend to run out of memory */
+ /*assert(xrb->pixmap);*/
}
/* for the FLIP macro: */