summaryrefslogtreecommitdiff
path: root/depends
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-06-17 15:48:32 +0400
committerAlexander Gavrilov2012-06-17 16:14:14 +0400
commit16ae6cb1fb06217e5b32f74ec72ce9fce1923b56 (patch)
treedfa9b9fe2954794fbc645de22e1b0edfa1a42977 /depends
parenteeaae916edc28baa065e277acde69b0674fd3fd2 (diff)
downloaddfhack-16ae6cb1fb06217e5b32f74ec72ce9fce1923b56.tar.gz
dfhack-16ae6cb1fb06217e5b32f74ec72ce9fce1923b56.tar.bz2
dfhack-16ae6cb1fb06217e5b32f74ec72ce9fce1923b56.tar.xz
Fix lua bug: 'peaceful' unwind of yielded pcall doesn't restore errfunc.
I.e. if the pcall results in no error, but a yield happens inside it, the active errfunc is not restored to its previous value.
Diffstat (limited to 'depends')
-rw-r--r--depends/lua/src/ldo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/depends/lua/src/ldo.c b/depends/lua/src/ldo.c
index d18e33cd..35d95ae4 100644
--- a/depends/lua/src/ldo.c
+++ b/depends/lua/src/ldo.c
@@ -402,6 +402,9 @@ static void finishCcall (lua_State *L) {
int n;
lua_assert(ci->u.c.k != NULL); /* must have a continuation */
lua_assert(L->nny == 0);
+ /* finish 'lua_pcallk' */
+ if (ci->callstatus & CIST_YPCALL)
+ L->errfunc = ci->u.c.old_errfunc;
/* finish 'lua_callk' */
adjustresults(L, ci->nresults);
/* call continuation function */