Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Tcl_NREvalObj() not as documented.

Closed / Fixed8ff0cb9fe16b30c7c511976616dc82bcb80dba5cCreated 13 years agoUpdated 13 years ago
Descriptionplain2013-08-21 14:16:03
proc foo {a b} {catch yield; return 1}
coroutine demo lsort -command foo {a b}

The [catch] fails to catch, and then a
few steps later, the program crashes.

The problem is with TclNRCoroutineObjCmd()
which is written to assume that calls to
Tcl_NREvalObj() behave as documented, that
they schedule the evaluation for later.
In fact, in many situations, T_NREO immediately
evals.

The branch dgp-purge-NRRunObjProc revises T_NREO
to behave as documented.  This change introduces
segfaults elsewhere, however.
Referenced by1
  • ec51e0603e[8ff0cb9fe1] Make Tcl_NREvalObj() (and friends) behave as documented, by only scheduling evaluation and not doing any of it until the caller routine returns. This fixes some serious errors in [coroutine] too. check-in2013-08-21 19:30:01
dgpplain2013-08-21 18:29:24
Segfaults were due to using storage on the
C stack for things that needed to continue
to be available after the C routine returned
in the NRE framework.
dgpplain2013-08-21 19:02:07
And then there was a memleak.

Thanks to the oo-0.4 test!

Fixed now.
dgpplain2013-08-21 19:30:56
Fix merged to trunk.
Log in (anonymous is fine) to add a comment.