summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-04-15 11:13:48 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-04-15 11:14:58 -0700
commitde1e43181bd670877b994db221ad8a04b5d63324 (patch)
treed0742c4d3a77bedc70b1ce459525a6e06b12fc7e
parentb3e3154cce47add97f5561088036ce3b9e7dc937 (diff)
DRI2: Don't leave empty entries in private->buffers
This should fix bug #21130. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--glx/glxdri2.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 9dac8a6a3..9e452c4fd 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -408,7 +408,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
408 __GLXDRIdrawable *private = loaderPrivate; 408 __GLXDRIdrawable *private = loaderPrivate;
409 DRI2BufferPtr buffers; 409 DRI2BufferPtr buffers;
410 int i; 410 int i;
411 int skip = 0; 411 int j;
412 412
413 buffers = DRI2GetBuffers(private->base.pDraw, 413 buffers = DRI2GetBuffers(private->base.pDraw,
414 width, height, attachments, count, out_count); 414 width, height, attachments, count, out_count);
@@ -422,23 +422,24 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
422 422
423 /* This assumes the DRI2 buffer attachment tokens matches the 423 /* This assumes the DRI2 buffer attachment tokens matches the
424 * __DRIbuffer tokens. */ 424 * __DRIbuffer tokens. */
425 j = 0;
425 for (i = 0; i < *out_count; i++) { 426 for (i = 0; i < *out_count; i++) {
426 /* Do not send the real front buffer of a window to the client. 427 /* Do not send the real front buffer of a window to the client.
427 */ 428 */
428 if ((private->base.pDraw->type == DRAWABLE_WINDOW) 429 if ((private->base.pDraw->type == DRAWABLE_WINDOW)
429 && (buffers[i].attachment == DRI2BufferFrontLeft)) { 430 && (buffers[i].attachment == DRI2BufferFrontLeft)) {
430 skip++;
431 continue; 431 continue;
432 } 432 }
433 433
434 private->buffers[i].attachment = buffers[i].attachment; 434 private->buffers[j].attachment = buffers[i].attachment;
435 private->buffers[i].name = buffers[i].name; 435 private->buffers[j].name = buffers[i].name;
436 private->buffers[i].pitch = buffers[i].pitch; 436 private->buffers[j].pitch = buffers[i].pitch;
437 private->buffers[i].cpp = buffers[i].cpp; 437 private->buffers[j].cpp = buffers[i].cpp;
438 private->buffers[i].flags = buffers[i].flags; 438 private->buffers[j].flags = buffers[i].flags;
439 j++;
439 } 440 }
440 441
441 *out_count -= skip; 442 *out_count = j;
442 return private->buffers; 443 return private->buffers;
443} 444}
444 445