diff options
author | dgp <dgp@users.sourceforge.net> | 2013-08-21 18:27:23 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-08-21 18:27:23 (GMT) |
commit | b9100f680a4f29439312a01ce54c8340b5d53374 (patch) | |
tree | d456cf30f308582fc643bd92b84a72e85308750a | |
parent | a0662f86df724a90e021f0917212446b1ce1bbcf (diff) | |
download | tcl-b9100f680a4f29439312a01ce54c8340b5d53374.zip tcl-b9100f680a4f29439312a01ce54c8340b5d53374.tar.gz tcl-b9100f680a4f29439312a01ce54c8340b5d53374.tar.bz2 |
Don't use automatic storage to hold the invocation words of oo::define.
That practice doesn't agree with NRE execution.
-rw-r--r-- | generic/tclOOBasic.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index f8cd1a4..073abab 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -88,7 +88,7 @@ TclOO_Class_Constructor( Tcl_Obj *const *objv) { Object *oPtr = (Object *) Tcl_ObjectContextObject(context); - Tcl_Obj *invoke[3]; + Tcl_Obj **invoke = ckalloc(3 * sizeof(Tcl_Obj *)); if (objc-1 > Tcl_ObjectContextSkippedArgs(context)) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -115,7 +115,7 @@ TclOO_Class_Constructor( Tcl_IncrRefCount(invoke[1]); Tcl_IncrRefCount(invoke[2]); TclNRAddCallback(interp, DecrRefsPostClassConstructor, - invoke[0], invoke[1], invoke[2], NULL); + invoke, NULL, NULL, NULL); /* * Tricky point: do not want the extra reported level in the Tcl stack @@ -131,9 +131,12 @@ DecrRefsPostClassConstructor( Tcl_Interp *interp, int result) { - TclDecrRefCount((Tcl_Obj *) data[0]); - TclDecrRefCount((Tcl_Obj *) data[1]); - TclDecrRefCount((Tcl_Obj *) data[2]); + Tcl_Obj **invoke = data[0]; + + TclDecrRefCount(invoke[0]); + TclDecrRefCount(invoke[1]); + TclDecrRefCount(invoke[2]); + ckfree(invoke); return result; } |