osmesa: remove old renderbuffer before adding new
authorBrian Paul <brianp@vmware.com>
Sat, 3 Jul 2010 00:18:15 +0000 (18:18 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 3 Jul 2010 00:22:53 +0000 (18:22 -0600)
Fixes fd.o bug 10966 when OSMesaMakeCurrent() was called twice.

NOTE: This is a candidate for the 7.8 branch.

src/mesa/drivers/osmesa/osmesa.c

index ead405039776272ca5755d88c5b97c8ba20dea67..93d0e8568a1061649fd1f584d3b1c2c22166e1c3 100644 (file)
@@ -1328,6 +1328,7 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
     * size.
     */
    osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
+   _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
    _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
    assert(osmesa->rb->RefCount == 2);