Avoid Devel::DProf failing an assertion during global destruction.
authorNicholas Clark <nick@ccl4.org>
Mon, 30 Oct 2006 18:37:41 +0000 (18:37 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 30 Oct 2006 18:37:41 +0000 (18:37 +0000)
p4raw-id: //depot/perl@29165

ext/Devel/DProf/DProf.xs

index 6ce8e52..57e0084 100644 (file)
@@ -370,9 +370,13 @@ prof_mark(pTHX_ opcode ptype)
 
        CV * const cv = db_get_cv(aTHX_ Sub);
        GV * const gv = CvGV(cv);
-       pname = GvSTASH(gv) ? HvNAME_get(GvSTASH(gv)) : NULL;
-       pname = pname ? pname : (char *) "(null)";
-       gname = GvNAME(gv);
+       if (isGV_with_GP(gv)) {
+           pname = GvSTASH(gv) ? HvNAME_get(GvSTASH(gv)) : NULL;
+           pname = pname ? pname : (char *) "(null)";
+           gname = GvNAME(gv);
+       } else {
+           gname = pname = (char *) "(null)";
+       }
 
        set_cv_key(aTHX_ cv, pname, gname);
        svp = hv_fetch(g_cv_hash, SvPVX_const(g_key_hash), SvCUR(g_key_hash), TRUE);