[Gtk-sharp-list] Medsphere.Widgets.FBox crashes with "must provide a protected or public IntPtr ctor"
Adam Tauno Williams
adam at morrison-ind.com
Tue Nov 4 09:13:01 EST 2008
> > I've create a widget that extends the very cool Medsphere FBox
> > 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.
> > 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.
> 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.
I managed to work around it. I created finalizers to make sure the
widgets were removed from the parent container, and even that the FBox
inherited container itself was empty. And still got the error (although
the finalizers did run).
So I just changed my widget to inherit from viewport and to insert the
FBox into itself. Presto, no error.
public class PhoneTable : Viewport
public PhoneTable(Whitemice.ZOGI.Company company) : base()
f = new Medsphere.Widgets.FBox();
foreach(Widget w in f)
Consonance: an Open Source .NET OpenGroupware client.
Contact:awilliam at whitemiceconsulting.com http://freshmeat.net/projects/consonance/
More information about the Gtk-sharp-list