;
#endif
+/* workaround RT #69939 */
+I32
+mouse_call_sv_safe(pTHX_ SV*, I32);
+
+#define call_sv_safe(sv, flags) mouse_call_sv_safe(aTHX_ sv, flags)
+#define call_method_safe(m, flags) mouse_call_sv_safe(aTHX_ newSVpvn_flags(m, strlen(m), SVs_TEMP), flags | G_METHOD)
+#define call_method_safes(m, flags) mouse_call_sv_safe(aTHX_ newSVpvs_flags(m, SVs_TEMP), flags | G_METHOD)
+
+
#define is_class_loaded(sv) mouse_is_class_loaded(aTHX_ sv)
bool mouse_is_class_loaded(pTHX_ SV*);
PUSHs(args);
PUTBACK;
- call_sv(AvARRAY(buildall)[i], G_VOID);
+ call_sv_safe(AvARRAY(buildall)[i], G_VOID);
/* discard a scalar which G_VOID returns */
SPAGAIN;
/* *{$package . '::' . $name} -> *gv */
gv = gv_fetchpv(form("%"SVf"::%"SVf, package, name), GV_ADDMULTI, SVt_PVCV);
mouse_install_sub(aTHX_ gv, code_ref);
+ //CvMETHOD_on((CV*)SvRV(code_ref));
(void)set_slot(methods, name, code); /* $self->{methods}{$name} = $code */
}
for(i = 0; i < items; i++){
PUSHs(ST(i));
}
- //SP += items;
+
PUTBACK;
- call_method("BUILDARGS", G_SCALAR);
+ call_method_safes("BUILDARGS", G_SCALAR);
+
SPAGAIN;
args = POPs;
PUTBACK;
GvSV(statusvalue) = sv_newmortal();
}
SAVESPTR(ERRSV); /* local $@ */
- ERRSV = newSVpvs_flags("", SVs_TEMP);
+ ERRSV = sv_newmortal();
+
+ EXTEND(SP, 2);
for(i = 0; i < len; i++){
SPAGAIN;
PUSHMARK(SP);
- XPUSHs(object);
- XPUSHs(boolSV(PL_dirty));
+ PUSHs(object);
+ PUSHs(boolSV(PL_dirty));
PUTBACK;
call_sv(AvARRAY(demolishall)[i], G_VOID | G_EVAL);
PUSHs(value);
PUTBACK;
- call_sv(trigger, G_VOID | G_DISCARD);
+ call_sv_safe(trigger, G_VOID | G_DISCARD);
/* need not SPAGAIN */
assert(SvTYPE(value) != SVTYPEMASK);
}
}
+/* workaround RT #69939 */
+I32
+mouse_call_sv_safe(pTHX_ SV* const sv, I32 const flags) {
+ assert( (flags & G_EVAL) == 0 );
+
+ if(!PL_in_eval) {
+ I32 count;
+ SAVESPTR(ERRSV);
+ ERRSV = sv_newmortal();
+
+ count = Perl_call_sv(aTHX_ sv, flags | G_EVAL);
+
+ if(sv_true(ERRSV)){
+ croak(NULL); /* rethrow */
+ }
+ return count;
+ }
+ else {
+ return Perl_call_sv(aTHX_ sv, flags);
+ }
+}
+
void
mouse_must_defined(pTHX_ SV* const value, const char* const name) {
assert(value);
XPUSHs(self);
PUTBACK;
- call_sv(method, G_SCALAR | G_METHOD);
+ call_sv_safe(method, G_SCALAR | G_METHOD);
SPAGAIN;
ret = POPs;
PUSHs(arg1);
PUTBACK;
- call_sv(method, G_SCALAR | G_METHOD);
+ call_sv_safe(method, G_SCALAR | G_METHOD);
SPAGAIN;
ret = POPs;