Hi,
I have stumbled across a problem in Imlib2 wrt language bindings.

imlib_image_put_back_data() assumes that the data pointer it has been
given points is the same that was returned by imlib_image_get_data().

When you're not using Imlib2's C interface, but some language binding,
this restriction can be hard to meet.

I suggest to apply the attached patch, which will memcpy() the data if
the pointer passed isn't the original pointer.

Is this okay to commit?

Regards,
Tilman

-- 
learn to quote: http://www.netmeister.org/news/learn2quote.html
Index: api.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/imlib2/src/lib/api.c,v
retrieving revision 1.2
diff -u -r1.2 api.c
--- api.c       2 Mar 2005 21:33:49 -0000       1.2
+++ api.c       29 May 2005 11:46:58 -0000
@@ -1479,6 +1479,10 @@
    CHECK_PARAM_POINTER("imlib_image_put_back_data", "image", ctx->image);
    CHECK_PARAM_POINTER("imlib_image_put_back_data", "data", data);
    CAST_IMAGE(im, ctx->image);
+
+   if (im->data != data)
+       memcpy(im->data, data, im->h * im->w * 4);
+
    __imlib_DirtyImage(im);
    data = NULL;
 }

Reply via email to