[Mesa-dev] [PATCH 03/13] mesa/main: Don't go freeing texture data which was never allocated
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/main/texstate.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 1af9d47..d133104 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -936,8 +936,10 @@ _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); -- 1.8.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/13] mesa/main: Don't go freeing texture data which was never allocated
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/main/texstate.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index e0f0852..6f7d781 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -930,8 +930,10 @@ _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); -- 1.8.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/13] mesa/main: Don't go freeing texture data which was never allocated
On 11/28/2014 04:25 AM, Juha-Pekka Heikkila wrote: Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@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); } } I don't understand those last two conditionals. If the pointer is already null, calling _mesa_reference_foo() shouldn't matter, right? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/13] mesa/main: Don't go freeing texture data which was never allocated
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@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 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev