video_widget: fix invalid snapshot memory

The buffer being passed to gdk_pixbuf_new_from_data() was being
allocated on the stack, however gdk_pixbuf_new_from_data() does
not make a copy of this memory. Thus the pixel data is no longer
valid once we leave the clutter_render_image() function, but
the GdkPixbuf is potentially used later.

This patch fixes this by mallocing the pixel memory and adding
a free function to call when the GdkPixbuf is destoryed. This
also fixes the corrupted bytes which are found in some avatars
once they are saved.

Change-Id: I25b2df51f769d527b8210e6388b5ce7bdd2f5e12
1 file changed