[Gtk-sharp-list] Strange GdkSharp.PixbufDestroyNotifyWrapper error..

Mauricio Henriquez mhenriquezs at terra.cl
Mon Jun 2 17:36:50 EDT 2008

Hi guys:

In a custom widget I use a pixbuf to update the image of the widget, I use:

internalPixbuf = new Pixbuf(buffer, Colorspace.Rgb, false, 8, 
ImageWidth, ImageHeight, ImageWidth * 3, null); //buffer of byte[]
but the app crash with:

ExcObject: System.InvalidProgramException: Invalid IL code in (wrapper 
native-to-managed) GdkSharp.PixbufDestroyNotifyWrapper:NativeCallback 
(intptr,intptr): IL_0030: call      0x00000006
 at (wrapper managed-to-native) 
System.Object:__icall_wrapper_mono_delegate_to_ftnptr (object)
at (wrapper managed-to-native) Gdk.Pixbuf:gdk_pixbuf_new_from_data 
 at Gdk.Pixbuf..ctor (System.Byte[] data, Colorspace colorspace, Boolean 
has_alpha, Int32 bits_per_sample, Int32 width, Int32 height, Int32 
rowstride, Gdk.PixbufDestroyNotify destroy_fn) [0x00000]

I use GLib.ExceptionManager.UnhandledException to get that info :-S ...

The weird thing is that with exactly the same code with mono-1.2.6 work 
like a charm and now the problem show up after a update to 

Mike, from mono-devel mailing list tell me that this is a "know issue" 
(https://bugzilla.novell.com/show_bug.cgi?id=362951), from that thread I 
read about a "problem with the image" (in my case a total crash..) and 
also talk about some patch and some fix needed in mono about the 
"MarchalAs.." for the byte[] type and the GC, but I'm really confuse if 
this is something that can be fixed (update soources from 
svn+patch+compilation don't seems to be a "easy" option) with other 
Also I try to use the PixbufLoader, but trying to build the pixbufloader 
with the (byte[], widht, height) constructor allways give me "Image with 
zero width" error..:-S, also try to use a MemoryStream to build the 
pixbufloader and the pixbuf with the same result..

there is some alternative?, is dificult to me to belive that this can't 
be handled in a diferent way, not posible to build the pixbuf beside a 
image from harddrive?, I use this custom widget with mono-1.2.6 (and the 
related version of gtk#) without any problem, and wait for a next RPM 
release for my fedora 8 is not a option for me...need to go back to 

any ideas?, sugestions?, prays?. black magic?, budu?



P.D: right now I'm using gtk-sharp2-100145-0.suse103.novell ..but same 

More information about the Gtk-sharp-list mailing list