From: Artur Bergman Date: Mon, 21 Apr 2003 17:05:31 +0000 (+0000) Subject: Croak on non ref to shared methods instead of segfault. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=56fcff86cbedc2a57183ad9c931fd8c116d23e4f;p=p5sagit%2Fp5-mst-13.2.git Croak on non ref to shared methods instead of segfault. This can really only happen for &share("string"). p4raw-id: //depot/perl@19299 --- diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs index 3e7916f..9e0f73b 100644 --- a/ext/threads/shared/shared.xs +++ b/ext/threads/shared/shared.xs @@ -965,6 +965,8 @@ SV* share(SV *ref) PROTOTYPE: \[$@%] CODE: + if(!SvROK(ref)) + Perl_croak(aTHX_ "Argument to share needs to be passed as ref"); ref = SvRV(ref); if(SvROK(ref)) ref = SvRV(ref); @@ -978,6 +980,8 @@ lock_enabled(SV *ref) PROTOTYPE: \[$@%] CODE: shared_sv* shared; + if(!SvROK(ref)) + Perl_croak(aTHX_ "Argument to lock needs to be passed as ref"); ref = SvRV(ref); if(SvROK(ref)) ref = SvRV(ref); @@ -992,6 +996,8 @@ cond_wait_enabled(SV *ref) CODE: shared_sv* shared; int locks; + if(!SvROK(ref)) + Perl_croak(aTHX_ "Argument to cond_wait needs to be passed as ref"); ref = SvRV(ref); if(SvROK(ref)) ref = SvRV(ref); @@ -1022,6 +1028,8 @@ cond_signal_enabled(SV *ref) PROTOTYPE: \[$@%] CODE: shared_sv* shared; + if(!SvROK(ref)) + Perl_croak(aTHX_ "Argument to cond_signal needs to be passed as ref"); ref = SvRV(ref); if(SvROK(ref)) ref = SvRV(ref); @@ -1038,6 +1046,8 @@ cond_broadcast_enabled(SV *ref) PROTOTYPE: \[$@%] CODE: shared_sv* shared; + if(!SvROK(ref)) + Perl_croak(aTHX_ "Argument to cond_broadcast needs to be passed as ref"); ref = SvRV(ref); if(SvROK(ref)) ref = SvRV(ref);