[Mesa-dev] [PATCH 1/2] st/dri: Don't leak bind counts on failure

Jakob Bornecrantz wallbraker at gmail.com
Tue Mar 29 16:33:00 PDT 2011


Signed-off-by: Jakob Bornecrantz <wallbraker at gmail.com>

NOTE: This is a candidate for the 7.10 branch.
---
 .../state_trackers/dri/common/dri_context.c        |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index e23c1bc..d23655a 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -173,12 +173,14 @@ dri_make_current(__DRIcontext * cPriv,
    if (old_st && old_st != ctx->st)
       old_st->flush(old_st, ST_FLUSH_FRONT, NULL);
 
+   /* check if either is not set */
+   if (!driDrawPriv ^ !driReadPriv)
+      return GL_FALSE;
+
    ++ctx->bind_count;
 
    if (!driDrawPriv && !driReadPriv)
       return ctx->stapi->make_current(ctx->stapi, ctx->st, NULL, NULL);
-   else if (!driDrawPriv || !driReadPriv)
-      return GL_FALSE;
 
    draw->context = ctx;
    if (ctx->dPriv != driDrawPriv) {
-- 
1.7.1



More information about the mesa-dev mailing list