[Gtk-sharp-list] Medsphere.Widgets.FBox crashes with "must provide a protected or public IntPtr ctor"

Christian Hoff christian_hoff at gmx.net
Tue Nov 4 08:05:39 EST 2008

Right, this errors occurs after the FBox has been disposed. Make sure 
that other Gtk+ classes are not holding references to this disposed 
object any more, otherwise you will run into errors in the callback 
functions(here Gtk.Container.Forall_cb).

As Forall executes a function for each of the container's children the 
disposed FBox is probably still a child of a container; you should call 

I got the same error when I was disposing a TreeModel. I had to set 
TreeView.Model to null to eliminate the reference to the model in the 
tree view.


Adam Tauno Williams schrieb:
> I've create a widget that extends the very cool Medsphere FBox
>   public class PhoneTable : Medsphere.Widgets.FBox
>   {
>     public PhoneTable(Whitemice.ZOGI.Company company) : base()
>     {
> 	...
>     }
>   }
> And it works for awhile.  Then it crashes with -
> Exception in Gtk# callback delegate
>   Note: Applications can use GLib.ExceptionManager.UnhandledException to
> handle the exception.
> GLib.MissingIntPtrCtorException: GLib.Object subclass
> Whitemice.ZOGI.GtkWidgets.PhoneTable must provide a protected or public
> IntPtr ctor to support wrapping of native object handles.
>   at GLib.ObjectManager.CreateObject (IntPtr raw) [0x00000] 
>   at GLib.Object.GetObject (IntPtr o, Boolean owned_ref) [0x00000] 
>   at Gtk.Container.Forall_cb (IntPtr container, Boolean
> include_internals, IntPtr cb, IntPtr data) [0x00000] 
>    at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e,
> Boolean is_terminal)
>    at Gtk.Container.Forall_cb(IntPtr container, Boolean
> include_internals, IntPtr cb, IntPtr data)
>    at GLib.ToggleRef.g_object_remove_toggle_ref(IntPtr ,
> GLib.ToggleNotifyHandler , IntPtr )
>    at GLib.ToggleRef.Free()
>    at GLib.Object.PerformQueuedUnrefs()
>    at GLib.Timeout+TimeoutProxy.Handler()
>    at Gtk.Application.gtk_main()
>    at Gtk.Application.Run()
>    at Whitemice.Consonance.Consonance.Main(System.String[] args)
> It seems like it happens as soon as an FBox has been disposed.  Is there
> something different with the Medsphere widgets?  I've bene using Gtk#
> for years and never had to deal with an IntPtr.

More information about the Gtk-sharp-list mailing list