[Mesa-dev] [PATCH 8/9] x11: take ownership rather than adding reference for new renderbuffers

Timothy Arceri tarceri at itsqueeze.com
Sat Apr 8 01:04:39 UTC 2017


This avoids locking in the reference calls and fixes a leak after the
RefCount initialisation was change from 0 to 1.

Fixes: 32141e53d1520 (mesa: tidy up renderbuffer RefCount initialisation)
---
 src/mesa/drivers/x11/xm_api.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 82c4d18..5be8aa9 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -304,39 +304,39 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
     * Front renderbuffer
     */
    b->frontxrb = xmesa_new_renderbuffer(NULL, 0, vis, GL_FALSE);
    if (!b->frontxrb) {
       free(b);
       return NULL;
    }
    b->frontxrb->Parent = b;
    b->frontxrb->drawable = d;
    b->frontxrb->pixmap = (XMesaPixmap) d;
-   _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_FRONT_LEFT,
-                          &b->frontxrb->Base.Base);
+   _mesa_add_renderbuffer_without_ref(&b->mesa_buffer, BUFFER_FRONT_LEFT,
+                                      &b->frontxrb->Base.Base);
 
    /*
     * Back renderbuffer
     */
    if (vis->mesa_visual.doubleBufferMode) {
       b->backxrb = xmesa_new_renderbuffer(NULL, 0, vis, GL_TRUE);
       if (!b->backxrb) {
          /* XXX free front xrb too */
          free(b);
          return NULL;
       }
       b->backxrb->Parent = b;
       /* determine back buffer implementation */
       b->db_mode = vis->ximage_flag ? BACK_XIMAGE : BACK_PIXMAP;
       
-      _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_BACK_LEFT,
-                             &b->backxrb->Base.Base);
+      _mesa_add_renderbuffer_without_ref(&b->mesa_buffer, BUFFER_BACK_LEFT,
+                                         &b->backxrb->Base.Base);
    }
 
    /*
     * Other renderbuffer (depth, stencil, etc)
     */
    _swrast_add_soft_renderbuffers(&b->mesa_buffer,
                                   GL_FALSE,  /* color */
                                   vis->mesa_visual.haveDepthBuffer,
                                   vis->mesa_visual.haveStencilBuffer,
                                   vis->mesa_visual.haveAccumBuffer,
-- 
2.9.3



More information about the mesa-dev mailing list