Dear Maintainer,
The following one-liner, crashes when pressing almost any key:
perl -mstfl -e 'stfl::create("vbox\n input\n input")->run(0)'
The crash prints this on stderr (it needs to be redirected to be visible):
Bizarre copy of UNKNOWN in subroutine entry at -e line 1.
More generally, $form->run() will always crash when returning undef, and
that happens whenever the user key was used or when an immediate mode was
requested. That makes the library useless.
The problem can, apparently, be traced back to swig. More precisely, in
/usr/share/swig2.0/perl5/perlstrings.swg, we have the following code:
%fragment("SWIG_FromCharPtrAndSize","header") {
SWIGINTERNINLINE SV *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
if (carray) {
sv_setpvn(obj, carray, size);
} else {
sv_setsv(obj, &PL_sv_undef);
}
return obj;
}
}
The perl documentation (perlxs(1)) says:
if( rpcb_gettime( host, &timep ) ){
ST(0) = sv_newmortal();
sv_setnv( ST(0), (double)timep);
}
else{
ST(0) = &PL_sv_undef;
}
The difference is the absence of sv_setsv for PL_sv_undef. Changing the
wrapper code to this:
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
if (carray) {
obj = sv_newmortal();
sv_setpvn(obj, carray, size);
} else {
obj = &PL_sv_undef;
}
return obj;
}
fixes the problem.
Perl v5.18.1 seems to be fine with the current version.