From: Larry Wall Date: Wed, 11 Jan 1995 19:01:09 +0000 (-0800) Subject: duplicate DESTROY X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d23b30860e3e4c1bd7e12ed5a35d1b90e7fa214c;p=p5sagit%2Fp5-mst-13.2.git duplicate DESTROY In order to fix the duplicate DESTROY bug, I need to remove [the modified] lines from sv_setsv. Basically, copying an object shouldn't produce another object without an explicit blessing. I'm not sure if this will break anything. If Ilya and anyone else so inclined would apply this patch and see if it breaks anything related to overloading (or anything else object-oriented), I'd be much obliged. By the way, here's a test script for the duplicate DESTROY. You'll note that it prints DESTROYED twice, once for , and once for . I don't think an object should be considered an object unless viewed through a reference. When accessed directly it should behave as a builtin type. #!./perl = new main; = ''; sub new { my ; local /tmp/ssh-vaEzm16429/agent.16429 = bless $a; local = ; # Bogusly makes an object. /tmp/ssh-vaEzm16429/agent.16429; } sub DESTROY { print "DESTROYED\n"; } Larry --- diff --git a/sv.c b/sv.c index 63dfa71..7776aa6 100644 --- a/sv.c +++ b/sv.c @@ -1629,10 +1629,6 @@ register SV *sstr; else { (void)SvOK_off(dstr); } - if (SvOBJECT(sstr)) { - SvOBJECT_on(dstr); - SvSTASH(dstr) = (HV*)SvREFCNT_inc(SvSTASH(sstr)); - } SvTAINT(dstr); }