Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
in <0x00000> <unknown method>
in (wrapper managed-to-native) Gtk.Application:gtk_main ()
in <0x00007> Gtk.Application:Run ()
in <0x00038> Crash:Main (System.String[] args)
and when I reproduce the crash with gdb --args mono crash.exe I get:
0xb6ff6618 in gtk_accel_group_find () from /usr/lib/libgtk-x11-2.0.so.0
and my X session is locked up until I switch to a VT and kill gdb. It's a simple class derrived from Gtk.Window that uses glade to load widgets. I add NodeView with a NodeStore and some columns. Here's the wierd thing: if the nodestore has 100 elements in it, and I click either the File or Edit menu I get the above crash. But if I change the number of elements by setting the rowCount member to 10,000 then I don't get a crash on those menu items.
I'm running Ubuntu Linux 5.04 with Mono 1.1.8.1 and I've tried both gtk-sharp-2.5.5 and gtk-sharp-1.9.5.
I've included the glade file and the source file that cause the crash, I've compiled the crash.cs file with the command:
mcs -pkg:glade-sharp-2.0 crash.cs
I don't think it's nodestore related since I've gotten the same results with my own NodeStore-like (copied pretty much from NodeStore, C code and all) treemodel and my ManagedTreeModel (purely managed treemodel derrived from Vladimir's).
I'm puzzled.
--
Caleb Land
([EMAIL PROTECTED])
// Test program for DSDataTable using System; using System.Collections; using Gtk; using Glade;
[TreeNode (ColumnCount=5)]
public class CrashTreeNode : TreeNode {
string name;
string desc;
string loc;
int id;
bool check;
static int count = 0;
public CrashTreeNode (string name, string desc)
{
this.name = name;
this.desc = desc;
this.loc = name + desc;
this.id = count;
if (count % 2 == 0) {
this.check = true;
} else {
this.check = false;
}
count++;
}
[TreeNodeValue (Column=0)]
public string Name {
get { return name; }
}
[TreeNodeValue (Column=1)]
public string Description {
get { return desc; }
}
[TreeNodeValue (Column=2)]
public string LocationCode {
get { return loc; }
}
[TreeNodeValue (Column=3)]
public int Id {
get { return id; }
}
[TreeNodeValue (Column=4)]
public bool Check {
get { return check; }
}
public static int Count {
get {
return count;
}
}
}
class Crash : Gtk.Window {
public int rowCount = 10000;
public NodeStore buildNodeStore () {
NodeStore store = new NodeStore (typeof (CrashTreeNode));
CrashTreeNode n;
string code, loc;
for (int i = 0; i < this.rowCount; ++i) {
code = String.Format("Code: {0}", i);
if (i % 2 == 0) // even
loc = "GREECE";
else
loc = "CHILI";
n = new CrashTreeNode (code, loc);
store.AddNode (n);
}
return store;
}
[Glade.Widget] public Toolbar toolbar;
[Glade.Widget] public VBox vbox;
[Glade.Widget] public Alignment alignment;
public Crash (string title) : base (title) {
Glade.XML xml = new Glade.XML ("crash.glade", "vbox", null);
xml.Autoconnect (this);
base.Add (vbox);
}
public void Start () {
NodeStore nodeStore = this.buildNodeStore ();
ScrolledWindow sw = new ScrolledWindow ();
NodeView nv = new NodeView (nodeStore);
nv.AppendColumn ("Code", new CellRendererText (), "text", 0);
nv.AppendColumn ("Description", new CellRendererText (), "text", 1);
nv.AppendColumn ("Location Code", new CellRendererText (), "text", 2);
nv.AppendColumn ("Id", new CellRendererText (), "text", 3);
nv.AppendColumn ("Checked", new CellRendererToggle (), "active", 4);
sw.Add(nv);
this.alignment.Add(sw);
this.DeleteEvent += this.window_deleted_cb;
this.Resize(800, 600);
this.ShowAll();
}
public static void Main(string[] args) {
Application.Init();
Crash crash = new Crash("Test mystery crash");
crash.Start();
Application.Run();
}
void window_deleted_cb (object o, DeleteEventArgs args) {
Application.Quit();
args.RetVal = true;
}
}
crash.glade
Description: application/glade
_______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
