[Gtk-sharp-list] TreeModelAdapter hangs with my TreeModelImplementor class

b0rg j.smirlis at gmail.com
Sun Mar 7 05:46:03 EST 2010


Hi 

This is my first post here. I'm moving from VS2005 to MonoDevelop and I try
to make some controls based on GTK#, that are more familiar with that I used
to work with. But I have very little experience with GTK.

I've been looking around in various posts on how to make a custom adapter
for a TreeView (in fact using a System.Data.Dataview) so I implement a
TreeModelImplementor with this:

http://n4.nabble.com/file/n1583443/GDataViewStore.cs GDataViewStore.cs 

and I use this class with this:

this.myTreeView.Model = new TreeModelAdapter(new
GDataViewStore(this.dView));

Everything works unexpectedly well if dataview has rows, but if dView is
empty (dView.Count==0) it hangs until it is killed by OOM killer. It seems
that IterNext is called forever.

If I change IterNext and check that there are no rows in dataview with this:

		public bool IterNext (ref Gtk.TreeIter iter)
		{
			if(dview.Count == 0) return false; // If dataview is empty, there is
nothing next
			int rowindex = GetRowByIter(iter);
			if(rowindex == dview.Count - 1) 
				return false;
			else {
				iter = GetIterByRow(rowindex + 1);
				return true;
			}
		}

I get a 
Gtk-CRITICAL **: file /build/buildd/gtk+2.0-2.18.3/gtk/gtktreeview.c: line
5944 (validate_visible_area): assertion `has_next' failed.
There is a disparity between the internal view of the GtkTreeView,
and the GtkTreeModel.  This generally means that the model has changed
without letting the view know.  Any display from now on is likely to
be incorrect.

and an out of range exception in GetValue.

Is there a right way to do this?

Forgive my long post, I would appreciate your assistance.

Thanks 
-- 
View this message in context: http://n4.nabble.com/TreeModelAdapter-hangs-with-my-TreeModelImplementor-class-tp1583443p1583443.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list