Salvador "FandiXo" wrote:
> the attached patch solves bug #37138, that was causing perl to crash
> when using an XSUB as DB::DB().

Thanks. Your patch is suitable for maintperl; I modified it as follows for
bleadperl :

Change 25511 by [EMAIL PROTECTED] on 2005/09/20 09:02:17

        Subject: PATCH for #37138: using XSUB as DB::DB causes perl to crash
        From: Salvador "FandiXo" <[EMAIL PROTECTED]>
        Date: Mon, 19 Sep 2005 06:56:39 -0700 (PDT)
        Message-ID: <[EMAIL PROTECTED]>
        
        (adapted to bleadperl)

Affected files ...

... //depot/perl/pp_ctl.c#479 edit

Differences ...

==== //depot/perl/pp_ctl.c#479 (text) ====

@@ -1771,13 +1771,24 @@
        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;

Reply via email to