Skip Menu |

This queue is for tickets about the Wx CPAN distribution.

Report information
The Basics
Id: 71177
Status: open
Priority: 0/
Queue: Wx

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: segv on passing undef
Date: Fri, 23 Sep 2011 09:45:38 +1000
To: bug-Wx [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
With recent debian i386 wx 2.8 and wxperl 0.9901 I mistakenly passed undef to the AboutDialogInfo SetIcon(), per foo.pl below, and got a segv. I expect it's "don't do that", but it'd be good if it was an error instead of a segv to avoid trouble.
use Wx; my $info = Wx::AboutDialogInfo->new; $info->SetIcon(undef);
CC: <wxperl-users [...] perl.org>
Subject: RE: [rt.cpan.org #71177] segv on passing undef
Date: Fri, 23 Sep 2011 09:58:56 -0300
To: <bug-Wx [...] rt.cpan.org>
From: "Steve Cookson" <steve.cookson [...] sca-uk.com>
Show quoted text
> -----Original Message----- > From: Kevin Ryde via RT [mailto:bug-Wx@rt.cpan.org] > With recent debian i386 wx 2.8 and wxperl 0.9901 I mistakenly passed > undef to the AboutDialogInfo SetIcon(), per foo.pl below, and got a > segv. I expect it's "don't do that", but it'd be good if it was an > error instead of a segv to avoid trouble.
Hi Kevin, I get the same under Windows. Don't you think it's a wxWidgets problem and not a wxPerl binding problem? The only strange thing is it crashes at the actual call: $info->SetIcon(undef); Show quoted text
>>>crash<<<
If you change to: $info->SetIcon(0); It steps through the call to Wx:: sub END { UnsetConstants() if defined &UnsetConstants; } It may be worth posting on wx-users@googlegroups.com. What do others think? Regards Steve
Subject: Re: [rt.cpan.org #71177] segv on passing undef
Date: Sat, 24 Sep 2011 09:21:39 +1000
To: bug-Wx [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
"Steve Cookson via RT" <bug-Wx@rt.cpan.org> writes: Show quoted text
> > Don't you think it's a wxWidgets problem and not a wxPerl binding > problem?
I presume it doesn't take NULL. If so it could be good if the bindings kept you away from that. Though might be hard unless wx itself declares where null is or isn't accepted.
CC: <wxperl-users [...] perl.org>
Subject: RE: [rt.cpan.org #71177] segv on passing undef
Date: Sat, 24 Sep 2011 22:14:38 -0300
To: <bug-Wx [...] rt.cpan.org>
From: "Steve Cookson" <steve.cookson [...] sca-uk.com>
Hi Kevin, Show quoted text
> I presume it doesn't take NULL.
NULL Meaning ""? It works like zero. Doesn't crash. But I'm not sure what the equivalent of undef on c++ is, is it null? I'd post it myself on wx-users@googlegroups.com if I could word a good message. Why don't you do this? Regards Steve
Subject: Re: [rt.cpan.org #71177] segv on passing undef
Date: Tue, 27 Sep 2011 06:36:55 +1000
To: bug-Wx [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
"Steve Cookson via RT" <bug-Wx@rt.cpan.org> writes: Show quoted text
> > NULL Meaning ""?
No I was looking at helpers.cpp void* wxPli_sv_2_object( pTHX_ SV* scalar, const char* classname ) { // is it correct to use undef as 'NULL'? if( !SvOK( scalar ) ) { return NULL; } where undef from perl becomes NULL and wondered if that NULL is allowed when reaching the actual wx routine. (And then to hope the wrappers might guard against it to avoid trouble.) But I say that only from nosing around, though gdb does report the segv as being from a null, 0xb74013f2 in wxObject::Ref(wxObject const&) () from /usr/lib/libwx_baseu-2.8.so.0 (gdb) where #0 0xb74013f2 in wxObject::Ref(wxObject const&) () from /usr/lib/libwx_baseu-2.8.so.0 #1 0xb7a83591 in XS_Wx__AboutDialogInfo_SetIcon () from /usr/lib/perl5/auto/Wx/Wx.so #2 0x080e3c63 in Perl_pp_entersub () #3 0x080db232 in Perl_runops_standard () #4 0x08081db1 in perl_run () #5 0x080657af in main () which is => 0xb74013f2 <+34>: mov 0x4(%edi),%eax with %edi containing 0.