[Gtk-sharp-list] Random NullReferenceExceptions in GLib
Todd Berman
tberman@off.net
Mon, 09 May 2005 21:57:42 -0700
--=-10tgmc4atgXuwZE5MnxC
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2005-05-06 at 18:39 -0700, Todd Berman wrote:
> On Fri, 2005-05-06 at 17:00 -0700, Eric Butler wrote:
> > My program is randomly throwing the following exception. Since it is in
> > unmanaged code (and in the Gtk mainloop), I have no idea how to even
> > begin debugging this. Can anyone please help? This is with Gtk# trunk.
> >
> > Unhandled Exception: System.NullReferenceException: Object reference not
> > set to an instance of an object
> > in (unmanaged) 0x8ac9250
> > in <0x00004> (wrapper managed-to-native) GLib.Object:g_object_unref
> > (intptr)
> > in [0x00099] (at /home/brady/sources/gtk-sharp/glib/Object.cs:65)
> > GLib.Object:PerformQueuedUnrefs ()
> > in <0x00048> (wrapper delegate-invoke)
> > System.MulticastDelegate:invoke_bool ()
> > in [0x0000d] (at /home/brady/sources/gtk-sharp/glib/Idle.cs:46)
> > IdleProxy:Handler ()
> > in <0x00036> (wrapper native-to-managed) IdleProxy:Handler ()
> > in (unmanaged) 0xb7f78a02
> > in <0x00004> (wrapper managed-to-native) Gtk.Application:gtk_main ()
> > in [0x00000] (at /home/brady/sources/gtk-sharp/gtk/Application.cs:99)
> > Gtk.Application:Run ()
> > in [0x002ce]
> > (at /home/brady/sources/FileFind.Meshwork.GtkClient/src/Main.cs:192)
> > gMeshwork:Go (string[])
> > in [0x00008]
> > (at /home/brady/sources/FileFind.Meshwork.GtkClient/src/Main.cs:72)
> > gMeshwork:Main (string[])
> >
> > Thanks :(
>
> I am actually starting to see this too, not sure what is going on at
> all, and it is also exposing itself under win32, so it is not linux
> specific. I am wondering what has recently changed.
>
> --Todd
Mike, I was able to make a small test case that shows this bug.
If you click the button and make the dialog come up, and then close the
dialog, and click the button, it crashes. Sometimes it takes 3 or 4
times showing the dialog for it to crash, but it does happen for sure.
I get this error here:
tberman@photon% mono test.exe
[~/temp]
Exception while disposing a Gtk.TreeViewColumn in GTK#
Unhandled Exception: System.ExecutionEngineException: SIGILL
in <0x00000> <unknown method>
in (wrapper managed-to-native) GLib.Object:g_object_unref (intptr)
in <0x00129> GLib.Object:PerformQueuedUnrefs ()
Test case has been attached.
--Todd
--=-10tgmc4atgXuwZE5MnxC
Content-Disposition: attachment; filename=test.cs
Content-Type: text/x-csharp; name=test.cs; charset=us-ascii
Content-Transfer-Encoding: 7bit
using System;
using Gtk;
public class Driver
{
public static void Main ()
{
Application.Init ();
new Driver ();
Application.Run ();
}
public Driver ()
{
Window wnd = new Window ("Driver");
Button btn = new Button ("Click");
wnd.Add (btn);
btn.Clicked += new EventHandler (OnBtnClicked);
wnd.ShowAll ();
}
private void OnBtnClicked (object o, EventArgs e)
{
CreateDialog ();
}
private Dialog CreateDialog ()
{
ListStore store = new ListStore (typeof (string));
for (int i = 0; i < 50; i++) {
store.AppendValues (i.ToString ());
}
TreeView tv = new TreeView ();
tv.Model = store;
tv.AppendColumn ("column", new CellRendererText (), new TreeCellDataFunc (RendererFunc));
Dialog dlg = new Dialog ();
ScrolledWindow scroller = new ScrolledWindow ();
scroller.Add (tv);
dlg.VBox.Add (scroller);
dlg.ShowAll ();
return dlg;
}
private void RendererFunc (TreeViewColumn col, CellRenderer renderer, TreeModel model, TreeIter iter)
{
CellRendererText text = renderer as CellRendererText;
text.Text = (string)model.GetValue (iter, 0);
}
}
--=-10tgmc4atgXuwZE5MnxC--