[tcljava-user] (no subject)
Brought to you by:
mdejong
From: Dan D. <dda...@ya...> - 2008-09-24 15:01:49
|
Hi, I am wondering why I need to "preserve" a TclList that I don't return to TCL, nor need/use after the function returns. I am trying to return just one sub-list from a list of sub-lists. If I have just a list of normal TclObjects I can return one item without a problem. What is wrong with this: public void cmdProc(Interp interp, TclObject argv[]) throws TclException { TclObject list = TclList.newInstance(); //Create the first sublist TclObject list1 = TclList.newInstance(); TclList.append(interp, list1, TclString.newInstance("1.1")); TclList.append(interp, list1, TclString.newInstance("1.2")); //Create the second sublist TclObject list2 = TclList.newInstance(); TclList.append(interp, list2, TclString.newInstance("2.1")); TclList.append(interp, list2, TclString.newInstance("2.2")); //Add to main list TclList.append(interp, list, list1); TclList.append(interp, list1, list2); //list.preserve(); //return just the second sublist list interp.setResult(TclList.index(interp, list, 0)); } When I run it (without the preserve()), I get this: % ls_test alloc: invalid block: 009B3DF0: f8 0 0 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. D:\ When I run a similar situation in my production code I get the error from JRE side, SIGSEGV on Linux and ACCESS_VIOLATION on Windows: # # An unexpected error has been detected by HotSpot Virtual Machine: # # SIGSEGV (0xb) at pc=0x4008eb78, pid=4098, tid=1074768448 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode, sharing) # Problematic frame: # C [libtcl8.4.so+0x77b78] # # An error report file with more information is saved as hs_err_pid4098.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # Aborted (core dumped) Thanks, Dan |