*** /space/home/jwu/tcl/blend.orig/tclBlend1.2.6/src/tcljava/tcl/lang/ReflectObject.java	Tue Aug 22 10:35:03 2000
--- ReflectObject.java	Wed Aug 23 10:24:45 2000
***************
*** 566,571 ****
--- 566,579 ----
  	
  	roRep.useCount = 1;
  	roRep.isValid  = true;	
+ 
+ 	if (obj instanceof TclObject) {
+ 	    // as the object being reflected is kept for a long time,
+ 	    // and the object being reflected is a TclObject, then
+ 	    // we must increment the ref count the TclObject.  Else,
+ 	    // the TclObject may not be valid later.
+ 	    ((TclObject) obj).preserve();
+ 	}
  	
  	if (debug) {
  	    System.out.println("POST REGISTER DUMP");
***************
*** 625,630 ****
--- 633,645 ----
  
  	removeFromReflectTable(this);
  
+ 	if (javaObj instanceof TclObject) {
+ 	    // if the object being reflected is a TclObject, then we
+ 	    // need to release it to signal that we no longer need to
+ 	    // use it.
+ 	    ((TclObject) javaObj).release();
+ 	}
+ 	
  	ownerInterp = null;
  	javaObj = null;
  	javaClass = null;
