retitle 821194 libwx-perl: dobule free at exit because of envvars handling
severity 821194  important
tag 821194 + patch
thanks

Hi,

the issue here is Perl crashing when closing down, in particular it
happens in perl/perl.c:perl_destruct, down in the cleanup of the custom
environment: apparently the perl interpreter was not the only one to set
environment variables.  Indeed, looking down the road, wxApp::Initialize
in wxWidgets calls its own wxSetEnv (which uses setenv).
A similar issue was reported for the Inline::Python module [1][2], and
fixed [3] by setting PL_use_safe_putenv=1: Wx::Perl actually sets it,
but only with DEBUGGING defined as well (which IIRC is set only when Perl
is built in debugging mode).

While the crash seems to happen on Hurd only, running the tests under
valgrind in a current sid chroot shows that valgrind reports double
free cases. Hence, I'm attaching the following patch to just remove the
check on DEBUGGING, and use PL_use_safe_putenv as it should
(the !PERL_USE_SAFE_PUTENV check needs to stay for builds of Perl with
"safe putenv").

Can you please apply it for Debian, and forward it upstream?

[1] https://github.com/niner/inline-python-pm/issues/7
[2] https://github.com/niner/inline-python-pm/issues/9
[3] 
https://github.com/niner/inline-python-pm/commit/35db0d3109880b9104c0a9d2562520997825de0c

Thanks,
-- 
Pino Toscano
--- a/Wx.xs
+++ b/Wx.xs
@@ -325,7 +325,7 @@ Load( bool croak_on_error = false )
 
     if( wxPerlAppCreated || wxTopLevelWindows.GetCount() > 0 )
         XSRETURN( true );
-#if defined(DEBUGGING) && !defined(PERL_USE_SAFE_PUTENV)
+#if !defined(PERL_USE_SAFE_PUTENV)
     // avoid crash on exit in Fedora (and other DEBUGGING Perls)
     PL_use_safe_putenv = 1;
 #endif

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to