From 538a92af4c40dae91012d0a2aacbee52a9ff86ca Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 29 Feb 2008 21:02:17 +0000 Subject: * generic/tclResult.c (Tcl_SetReturnOptions): Revised the refcount management of Tcl_SetReturnOptions to become that of a conventional Consumer routine. Thanks to Peter Spjuth for pointing out the difficulties calling Tcl_SetReturnOptions with non-0-count value for options. * generic/tclExecute.c (INST_RETURN_STK): Revised the one caller within Tcl itself which passes a non-0-count value to Tcl_SetReturnOptions(). --- ChangeLog | 9 +++++++++ generic/tclExecute.c | 3 ++- generic/tclResult.c | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67de549..8402a87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2008-02-28 Don Porter + * generic/tclResult.c (Tcl_SetReturnOptions): Revised the refcount + management of Tcl_SetReturnOptions to become that of a conventional + Consumer routine. Thanks to Peter Spjuth for pointing out the + difficulties calling Tcl_SetReturnOptions with non-0-count value for + options. + * generic/tclExecute.c (INST_RETURN_STK): Revised the one caller + within Tcl itself which passes a non-0-count value to + Tcl_SetReturnOptions(). + * generic/tclBasic.c (Tcl_AppendObjToErrorInfo): Revised the refcount management of Tcl_AppendObjToErrorInfo to become that of a conventional Consumer routine. This preserves the ease of use diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 6840574..25df0e7 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.363 2008/02/04 20:24:55 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.364 2008/02/29 21:02:20 dgp Exp $ */ #include "tclInt.h" @@ -1866,6 +1866,7 @@ TclExecuteByteCode( TRACE(("=> ")); objResultPtr = POP_OBJECT(); result = Tcl_SetReturnOptions(interp, OBJ_AT_TOS); + Tcl_DecrRefCount(OBJ_AT_TOS); OBJ_AT_TOS = objResultPtr; if (result == TCL_OK) { TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")", diff --git a/generic/tclResult.c b/generic/tclResult.c index e000a19..f9ef5b6 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclResult.c,v 1.45 2007/12/13 15:23:20 dgp Exp $ + * RCS: @(#) $Id: tclResult.c,v 1.46 2008/02/29 21:02:20 dgp Exp $ */ #include "tclInt.h" @@ -1494,6 +1494,7 @@ Tcl_SetReturnOptions( int objc, level, code; Tcl_Obj **objv, *mergedOpts; + Tcl_IncrRefCount(options); if (TCL_ERROR == TclListObjGetElements(interp, options, &objc, &objv) || (objc % 2)) { Tcl_ResetResult(interp); -- cgit v0.12