From ae07dea93d3f3fb0559bbe0f71183a9cc95d7f75 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Mon, 8 Jun 2009 16:45:43 -0400 Subject: [PATCH] Fix unitialized first_pixels for foreign textures tex->first_pixels was never set for foreign textures, leading to a crash when the texture object is freed. As a quick fix, simply set to NULL. A more complete fix would require remembering if we had ever seen the first pixel uploaded, and if not, doing a glReadPixel to get it before triggering the mipmap update. http://bugzilla.openedhand.com/show_bug.cgi?id=1645 Signed-off-by: Neil Roberts --- gl/cogl-texture.c | 2 ++ gles/cogl-texture.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gl/cogl-texture.c b/gl/cogl-texture.c index 215e14c78..ad25195f9 100644 --- a/gl/cogl-texture.c +++ b/gl/cogl-texture.c @@ -1600,6 +1600,8 @@ cogl_texture_new_from_foreign (GLuint gl_handle, g_array_append_val (tex->slice_gl_handles, gl_handle); + tex->first_pixels = NULL; + return _cogl_texture_handle_new (tex); } diff --git a/gles/cogl-texture.c b/gles/cogl-texture.c index 1929184c0..d650b7015 100644 --- a/gles/cogl-texture.c +++ b/gles/cogl-texture.c @@ -1676,6 +1676,8 @@ cogl_texture_new_from_foreign (GLuint gl_handle, g_array_append_val (tex->slice_gl_handles, gl_handle); + tex->first_pixels = NULL; + return _cogl_texture_handle_new (tex); }