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

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Fri Nov 28 03:25:08 PST 2014


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 a737463..72c5c18 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