After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 328612 - TreeIter.getParent() seems to return invalid TreeIters
TreeIter.getParent() seems to return invalid TreeIters
Status: RESOLVED FIXED
Product: java-gnome
Classification: Bindings
Component: GTK
mainline
Other Linux
: Normal normal
: ---
Assigned To: Remy Suen
java-gnome bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-25 16:48 UTC by Lars Weber
Modified: 2006-04-27 00:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple testcase (without main() method) (2.05 KB, text/plain)
2006-01-25 16:54 UTC, Lars Weber
  Details
Patch to have getParent() return the right TreeIter. (2.41 KB, patch)
2006-02-01 00:03 UTC, Remy Suen
accepted-commit_now Details | Review
Remy's patch, reformatted (1.97 KB, patch)
2006-03-10 02:13 UTC, Andrew Cowie
committed Details | Review

Description Lars Weber 2006-01-25 16:48:38 UTC
As already reported on the mailing list I consequently get two Exceptions and null as the return value when calling .toString() on a TreeIter returned from getParent() on another TreeIter.
Comment 1 Lars Weber 2006-01-25 16:54:35 UTC
Created attachment 58107 [details]
Simple testcase (without main() method)

The attached testcase produces the following output here:

-------8<-------
java.lang.Exception: gtk_tree_store_get_path: assertion `iter->stamp == GTK_TREE_STORE (tree_model)->stamp' failed
	at org.gnu.glib.GObject.printStackTrace(GObject.java:616)
	at org.gnu.gtk.TreeIter.gtk_tree_model_get_string_from_iter(Native Method)
	at org.gnu.gtk.TreeIter.toString(TreeIter.java:115)
	at net.digiterror.gtk.TreeIterGetParentError.setupTreeStore(TreeIterGetParentError.java:77)
	at net.digiterror.gtk.TreeIterGetParentError.<init>(TreeIterGetParentError.java:25)
	at net.digiterror.gtk.Main.main(Main.java:9)
java.lang.Exception: gtk_tree_model_get_string_from_iter: assertion `path != NULL' failed
	at org.gnu.glib.GObject.printStackTrace(GObject.java:616)
	at org.gnu.gtk.TreeIter.gtk_tree_model_get_string_from_iter(Native Method)
	at org.gnu.gtk.TreeIter.toString(TreeIter.java:115)
	at net.digiterror.gtk.TreeIterGetParentError.setupTreeStore(TreeIterGetParentError.java:77)
	at net.digiterror.gtk.TreeIterGetParentError.<init>(TreeIterGetParentError.java:25)
	at net.digiterror.gtk.Main.main(Main.java:9)
Parent: null
---------->8----------

You'll need to add a main() method yourself to run the program.  It should look something like this:

----------8<-----------
	public static void main(String[] args) {
		Gtk.init(args);
		
		new TreeIterGetParentError();
		
		Gtk.main();
	}
------->8---------
Comment 2 Remy Suen 2006-02-01 00:03:12 UTC
Created attachment 58487 [details] [review]
Patch to have getParent() return the right TreeIter.

Please try applying this patch to check if it solves the problem. It did for me.
Comment 3 Andrew Cowie 2006-02-01 11:59:18 UTC
Tested it by applying and running both Lars's example as well as my usual code. Runs fine in my environment. Good show, Remy.

I think this should be your first commit.

AfC
Comment 4 Lars Weber 2006-02-02 01:58:56 UTC
For some strange reason my test case now simply terminates with exit code -1 when the call to .getParent() is made.

I simply applied the patch an ran make + make install on libgtk-java and libglade-java.  Currently I'm out of ideas of how to investigate further.  Maybe tomorrow I'll have some other ideas.
Comment 5 Andrew Cowie 2006-02-02 06:03:21 UTC
{shrug}

I tested it with the revised version of your program I posted to the mailing list.

Note that as this involved a JNI change, you must make sure you are sourcing both the ${prefix} jar file AND the ${prefix} library which generally involves having to set both LD_LIBRARY_PATH environment variable and -Djava.library.path argument to the VM.

AfC
Comment 6 Lars Weber 2006-02-21 17:33:52 UTC
I'm somewhat at a loss now.  When compiling and starting the test case from the console it terminates with a segmentation fault.  Using jdb I get the following:

> run
run TreeIterGetParent
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
The application has been disconnected

(jdb then exits)

Eclipse just tells me that the application exited with exit code -1.  Debugging inside Eclipse I get the following dialog when stepping into TreeIter.getParent()->TreeIter.gtk_tree_model_get_parent(Handle, Handle)->Handle32Bits.<init>():

Exceptions occurred attempting to step into the frame
Details >>
com.sun.jdi.VMDisconnectedException: Got IOException from Virtual Machine occured stepping in thread.
Got IOException from Virtual Machine

I'm not at all experienced in debugging java programs so I'm unsure on how to proceed.
Comment 7 Lars Weber 2006-02-21 17:42:50 UTC
FWIW: I completely reinstalled java-gnome (without gnome/gconf) from CVS HEAD today before testing.  First I compiled, installed and tested jg-common/cairo/gtk/gconf without changes, then I deinstalled gtk/glade again, applied the patch (the non-jni-part by hand because Eclipse mentioned version differences) and finally recompiled and reinstalled first libgtk-java and then libglade-java.
Comment 8 Remy Suen 2006-02-21 23:27:35 UTC
This is very strange indeed. I'm not familiar with how to debug JG applications whilst it's traversing through native code, so I can't really help you there either I'm afraid. Do you have a different VM installed that you can try it on perhaps?
Comment 9 Lars Weber 2006-02-22 13:04:32 UTC
The only other VM I have installed is GCJ which fails because of a missing implementation of java.lang.StringBuilder (new in Java 1.5 I believe)
Comment 10 Andrew Cowie 2006-03-10 02:11:51 UTC
I just retested the original test case against Remy's patch, and the Exceptions that were being thrown are no longer present. Recommend commit.

AfC
Comment 11 Andrew Cowie 2006-03-10 02:13:49 UTC
Created attachment 61015 [details] [review]
Remy's patch, reformatted

Should cleanly apply now.
Comment 12 Remy Suen 2006-03-10 02:56:09 UTC
Committed to CVS and also closing this bug.

Lars, please give this test case another try when 2.8.4 is released which I hope will help remove some environment differences and possible build hiccups. If you find that you are still having this problem, please feel free to reopen this bug.
Comment 13 Lars Weber 2006-03-10 12:25:26 UTC
Ok, I'll do so.

Thanks for trying to moving this onwards!
Comment 14 Andrew Cowie 2006-04-27 00:01:50 UTC
Remy notes that a similar issue has cropped up again. See bug #339788.

AfC