summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-12-02 19:41:43 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-12-02 19:41:43 +0000
commit99f13343cf270d8dfde8445ae363d9b05256e05b (patch)
treefe00b079a35d0d828259307a897920768f7b2fde /src/mesa
parent1b3128cc9a6b51874bf98871ec1b171049770d71 (diff)
Fix two failures encountered when running out of memory during XImage
allocation. Append \n to _mesa_warning() strings.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/x11/xm_api.c28
-rw-r--r--src/mesa/drivers/x11/xm_buffer.c5
2 files changed, 18 insertions, 15 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index aa0f8917f0..2bcbd2c3b0 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -509,7 +509,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;
}
@@ -517,10 +517,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;
}
@@ -528,11 +528,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;
}
@@ -631,21 +631,23 @@ 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");
return;
}
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;
}
@@ -1252,7 +1254,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 64a920da2b..8067b64840 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.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -98,7 +98,8 @@ xmesa_alloc_back_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);*/
}
return GL_TRUE;