[Mesa-dev] [PATCH 08/13] mesa/main: Don't go deleting unallocated TransformFeedbackObjects

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Tue May 5 04:25:24 PDT 2015


Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/main/transformfeedback.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 103011c..cbf8598 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -192,13 +192,17 @@ _mesa_free_transform_feedback(struct gl_context *ctx)
                                  NULL);
 
    /* Delete all feedback objects */
-   _mesa_HashDeleteAll(ctx->TransformFeedback.Objects, delete_cb, ctx);
-   _mesa_DeleteHashTable(ctx->TransformFeedback.Objects);
+   if (ctx->TransformFeedback.Objects) {
+      _mesa_HashDeleteAll(ctx->TransformFeedback.Objects, delete_cb, ctx);
+      _mesa_DeleteHashTable(ctx->TransformFeedback.Objects);
+   }
 
    /* Delete the default feedback object */
    assert(ctx->Driver.DeleteTransformFeedback);
-   ctx->Driver.DeleteTransformFeedback(ctx,
-                                       ctx->TransformFeedback.DefaultObject);
+   if (ctx->TransformFeedback.DefaultObject) {
+      ctx->Driver.DeleteTransformFeedback(ctx,
+                                        ctx->TransformFeedback.DefaultObject);
+   }
 
    ctx->TransformFeedback.CurrentObject = NULL;
 }
-- 
1.8.5.1



More information about the mesa-dev mailing list