Index: generic/tclEvent.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclEvent.c,v
retrieving revision 1.69
diff -u -r1.69 tclEvent.c
--- generic/tclEvent.c	13 Nov 2006 08:23:07 -0000	1.69
+++ generic/tclEvent.c	27 Feb 2007 17:25:37 -0000
@@ -200,11 +200,16 @@
 	int code, prefixObjc;
 	Tcl_Obj **prefixObjv, **tempObjv;
 
+	/*
+	 * Note we copy the handler command prefix each pass through, so
+	 * we do support one handler setting another handler.
+	 */
+
+	Tcl_Obj *copyObj = TclListObjCopy(NULL, assocPtr->cmdPrefix);
+
 	errPtr = assocPtr->firstBgPtr;
 
-	Tcl_IncrRefCount(assocPtr->cmdPrefix);
-	Tcl_ListObjGetElements(NULL, assocPtr->cmdPrefix, &prefixObjc,
-		&prefixObjv);
+	Tcl_ListObjGetElements(NULL, copyObj, &prefixObjc, &prefixObjv);
 	tempObjv = (Tcl_Obj **) ckalloc((prefixObjc+2)*sizeof(Tcl_Obj *));
 	memcpy(tempObjv, prefixObjv, prefixObjc*sizeof(Tcl_Obj *));
 	tempObjv[prefixObjc] = errPtr->errorMsg;
@@ -216,7 +221,7 @@
 	 * Discard the command and the information about the error report.
 	 */
 
-	Tcl_DecrRefCount(assocPtr->cmdPrefix);
+	Tcl_DecrRefCount(copyObj);
 	Tcl_DecrRefCount(errPtr->errorMsg);
 	Tcl_DecrRefCount(errPtr->returnOpts);
 	assocPtr->firstBgPtr = errPtr->nextPtr;
