From 0515ee22c2bfdf0b837280ebfb01235b127f3f37 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 27 Aug 2008 12:56:54 +0000 Subject: [PATCH] 2008-08-27 Emmanuele Bassi Bug 1082 - Texture bitmap is destroyed in wrong way * clutter/cogl/common/cogl-bitmap-pixbuf.c: (_cogl_bitmap_from_file): Make a copy of the pixbuf data in the internal image loader so that we can keep working under the assumption that we are using the GLib memory allocation and deallocation functions. --- ChangeLog | 10 ++++++++++ clutter/cogl/common/cogl-bitmap-pixbuf.c | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index df78dbc9d..b002b5a20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-08-27 Emmanuele Bassi + + Bug 1082 - Texture bitmap is destroyed in wrong way + + * clutter/cogl/common/cogl-bitmap-pixbuf.c: + (_cogl_bitmap_from_file): Make a copy of the pixbuf data in + the internal image loader so that we can keep working under + the assumption that we are using the GLib memory allocation + and deallocation functions. + 2008-08-27 Emmanuele Bassi Bug 1099 - No ClutterScript API to get a list of IDs in a given file diff --git a/clutter/cogl/common/cogl-bitmap-pixbuf.c b/clutter/cogl/common/cogl-bitmap-pixbuf.c index 5c4f0dbf2..77316dff5 100644 --- a/clutter/cogl/common/cogl-bitmap-pixbuf.c +++ b/clutter/cogl/common/cogl-bitmap-pixbuf.c @@ -297,12 +297,14 @@ _cogl_bitmap_from_file (CoglBitmap *bmp, if (pixels == NULL) return FALSE; /* Store bitmap info */ - bmp->data = pixels; + bmp->data = g_memdup (pixels, height * width * 4); bmp->format = COGL_PIXEL_FORMAT_RGBA_8888; bmp->width = width; bmp->height = height; bmp->rowstride = width * 4; + free (pixels); + return TRUE; } #endif