Fix SEGV when debugging with foreach() lvalue patch
Ilya Zakharevich [Thu, 27 Feb 1997 19:24:36 +0000 (14:24 -0500)]
p5p-msgid: <199702271924.OAA14557@monk.mps.ohio-state.edu>

sv.c

diff --git a/sv.c b/sv.c
index 65d7d30..8f6bbe9 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -2624,6 +2624,9 @@ register SV *sv;
                sv_upgrade(&ref, SVt_RV);
                SvRV(&ref) = SvREFCNT_inc(sv);
                SvROK_on(&ref);
+               SvREFCNT(&ref) = 1;     /* Fake, but otherwise
+                                          creating+destructing a ref
+                                          leads to disaster. */
 
                EXTEND(SP, 2);
                PUSHMARK(SP);