From: Salvador FandiƱo Date: Mon, 19 Sep 2005 06:56:39 +0000 (-0700) Subject: PATCH for #37138: using XSUB as DB::DB causes perl to crash X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c127bd3aaa5c5e270737ea0eab0c61722c32271e;p=p5sagit%2Fp5-mst-13.2.git PATCH for #37138: using XSUB as DB::DB causes perl to crash Message-ID: <20050919135639.96726.qmail@web52701.mail.yahoo.com> (adapted to bleadperl) p4raw-id: //depot/perl@25511 --- diff --git a/pp_ctl.c b/pp_ctl.c index 0e31353..12e49ec 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1771,13 +1771,24 @@ PP(pp_dbstate) hasargs = 0; SPAGAIN; - PUSHBLOCK(cx, CXt_SUB, SP); - PUSHSUB_DB(cx); - cx->blk_sub.retop = PL_op->op_next; - CvDEPTH(cv)++; - SAVECOMPPAD(); - PAD_SET_CUR_NOSAVE(CvPADLIST(cv), 1); - RETURNOP(CvSTART(cv)); + if (CvXSUB(cv)) { + CvDEPTH(cv)++; + PUSHMARK(SP); + (void)(*CvXSUB(cv))(aTHX_ cv); + CvDEPTH(cv)--; + FREETMPS; + LEAVE; + return NORMAL; + } + else { + PUSHBLOCK(cx, CXt_SUB, SP); + PUSHSUB_DB(cx); + cx->blk_sub.retop = PL_op->op_next; + CvDEPTH(cv)++; + SAVECOMPPAD(); + PAD_SET_CUR_NOSAVE(CvPADLIST(cv), 1); + RETURNOP(CvSTART(cv)); + } } else return NORMAL;