Gdk::Pixbuf::create_from_data strange behaviour



Hello,

I'm creating a pixbuf from a pixel array like this :

Glib::RefPtr<Gdk::Pixbuf> =
Gdk::Pixbuf::create_from_data(array,Gdk::COLORSPACE_RGB,false, 8,sizeX,sizeY,sizeX*3);

The problem is that if after this call to create_from_data() I do a free() on the pixel array then the program crash when I try to use the Pixbuf... If I don't free() the pixel array then I can use my Pixbuf normally, display it etc.

So, create_from_data() don't copy the pixel array in the Pixbuf ?

And, I see that there is a create_from_inline() which take as argument a bool copy_pixels ? Can I use this function (how?) so that I can free() the pixel array after Pixbuf was created ?

Thanks for your help :)

Aurelien




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]