[Mesa-dev] [PATCH 03/13] mesa/main: Don't go freeing texture data which was never allocated
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Fri Nov 28 03:25:03 PST 2014
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
src/mesa/main/texstate.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index e0f0852..7f29208 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -930,14 +930,19 @@ _mesa_free_texture_data(struct gl_context *ctx)
}
/* Free proxy texture objects */
- for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++)
- ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
+ for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
+ if (ctx->Texture.ProxyTex[tgt])
+ ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
+ }
/* GL_ARB_texture_buffer_object */
- _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject, NULL);
+ if (ctx->Texture.BufferObject)
+ _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject, NULL);
for (u = 0; u < Elements(ctx->Texture.Unit); u++) {
- _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[u].Sampler, NULL);
+ if (ctx->Texture.Unit[u].Sampler)
+ _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[u].Sampler,
+ NULL);
}
}
--
1.8.5.1
More information about the mesa-dev
mailing list