GNOME Bugzilla – Bug 328612
TreeIter.getParent() seems to return invalid TreeIters
Last modified: 2006-04-27 00:01:50 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.
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---------
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.
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
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.
{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
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.
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.
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?
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)
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
Created attachment 61015 [details] [review] Remy's patch, reformatted Should cleanly apply now.
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.
Ok, I'll do so. Thanks for trying to moving this onwards!
Remy notes that a similar issue has cropped up again. See bug #339788. AfC