I have a small test program that consistently crashes.  I can't tell if
the crash is due to Wx or Perl, but I can trigger it on and off by how I use
a recent Perl feature.

 Here is the program (it is also attached as "test.pl"):


#!perl
use Wx;
package MyApp;
use base 'Wx::App';
use MyList;

sub OnInit
{
    my $self = shift;

    my $frame = Wx::Frame->new(undef, -1, 'title');
    my $panel = Wx::Panel->new($frame);

    MyList->new(parent => $panel, pos => [10, 30], size => [500, 200]);
    $frame->Show(1);
    return 1;
}
# ---------------------------------
# Create the application object, and pass control to it.
package main;
my $app = MyApp->new;
$app->MainLoop;

"MyList" is a control derived from Wx::ListCtrl.  Here is its code (also
attached as "MyList.pm"):


package MyList;
use Modern::Perl;
use Wx qw(:listctrl);
use base 'Wx::ListCtrl';

use Hash::Util::FieldHash;
Hash::Util::FieldHash::fieldhash     # This is line 7
my %some_attribute;

 sub new
{
    my $class = shift;
    my %parm = @_;
    my $pos  = $parm{pos}  || [-1, 1];
    my $size = $parm{size} || [-1, 1];

    # Construct list control object
    my $self  = $class->SUPER::new($parm{parent}, -1, $pos, $size,
                                   wxLC_REPORT | wxLC_HRULES | wxLC_VRULES,
                                  );
    # Init member data
    $some_attribute{$self} = 'sad';

    # Initialize column
    $self->InsertColumn(0, 'Zero');
    return $self;
}
1;

    This is a pretty straightforward, inside-out object.  It doesn't do
anything but call Wx::ListCtrl's constructor with some fixed style
parameters, and inserts a column titled "Zero".  It stores the value "sad"
in a member attribute that is a Fieldhash.

    This program crashes consistently every time I run it.  My system is
Windows 7 Professional 64-bit, 4gb RAM, dual-monitor, with Strawberry Perl
5.12.1 (MSWin32-x86-multi-thread), with Wx.pm version 0.98, and wxWidgets
2.8.10.  The Windows Error Report is attached as "WEReport.txt".

    Now the interesting part:  Comment out line 7 (turning %some_attribute
from a field hash into a regular old hash), and the program no longer
crashes.  I don't know if Hash::Util::FieldHash is doing something bad, or
if it's doing something that confuses Wx, or if Wx is doing something bad.

-- 
Eric J. Roode
Version=1
EventType=APPCRASH
EventTime=129357098989130429
ReportType=2
Consent=1
UploadTime=129357098990380554
ReportIdentifier=dc11330d-fd8b-11df-9364-0019bb422745
IntegratorReportIdentifier=dc11330c-fd8b-11df-9364-0019bb422745
WOW64=1
Response.type=4
Sig[0].Name=Application Name
Sig[0].Value=perl.exe
Sig[1].Name=Application Version
Sig[1].Value=0.0.0.0
Sig[2].Name=Application Timestamp
Sig[2].Value=4c520505
Sig[3].Name=Fault Module Name
Sig[3].Value=wxmsw28u_core_gcc_custom.dll
Sig[4].Name=Fault Module Version
Sig[4].Value=2.8.10.0
Sig[5].Name=Fault Module Timestamp
Sig[5].Value=4cf572b2
Sig[6].Name=Exception Code
Sig[6].Value=c0000005
Sig[7].Name=Exception Offset
Sig[7].Value=00084a5b
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=6.1.7600.2.0.0.256.48
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
DynamicSig[22].Name=Additional Information 1
DynamicSig[22].Value=0a9e
DynamicSig[23].Name=Additional Information 2
DynamicSig[23].Value=0a9e372d3b4ad19135b953a78882e789
DynamicSig[24].Name=Additional Information 3
DynamicSig[24].Value=0a9e
DynamicSig[25].Name=Additional Information 4
DynamicSig[25].Value=0a9e372d3b4ad19135b953a78882e789
UI[2]=C:\strawberry\perl\bin\perl.exe
UI[3]=perl.exe has stopped working
UI[4]=Windows can check online for a solution to the problem.
UI[5]=Check online for a solution and close the program
UI[6]=Check online for a solution later and close the program
UI[7]=Close the program
LoadedModule[0]=C:\strawberry\perl\bin\perl.exe
LoadedModule[1]=C:\Windows\SysWOW64\ntdll.dll
LoadedModule[2]=C:\Windows\syswow64\kernel32.dll
LoadedModule[3]=C:\Windows\syswow64\KERNELBASE.dll
LoadedModule[4]=C:\strawberry\perl\bin\perl512.dll
LoadedModule[5]=C:\Windows\syswow64\ADVAPI32.DLL
LoadedModule[6]=C:\Windows\syswow64\msvcrt.dll
LoadedModule[7]=C:\Windows\SysWOW64\sechost.dll
LoadedModule[8]=C:\Windows\syswow64\RPCRT4.dll
LoadedModule[9]=C:\Windows\syswow64\SspiCli.dll
LoadedModule[10]=C:\Windows\syswow64\CRYPTBASE.dll
LoadedModule[11]=C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16661_none_420fe3fa2b8113bd\COMCTL32.DLL
LoadedModule[12]=C:\Windows\syswow64\GDI32.dll
LoadedModule[13]=C:\Windows\syswow64\USER32.dll
LoadedModule[14]=C:\Windows\syswow64\LPK.dll
LoadedModule[15]=C:\Windows\syswow64\USP10.dll
LoadedModule[16]=C:\Windows\syswow64\SHLWAPI.dll
LoadedModule[17]=C:\Windows\syswow64\WS2_32.DLL
LoadedModule[18]=C:\Windows\syswow64\NSI.dll
LoadedModule[19]=C:\strawberry\perl\bin\libgcc_s_sjlj-1.dll
LoadedModule[20]=C:\Windows\system32\IMM32.DLL
LoadedModule[21]=C:\Windows\syswow64\MSCTF.dll
LoadedModule[22]=C:\strawberry\perl\lib\auto\attributes\attributes.dll
LoadedModule[23]=C:\strawberry\perl\site\lib\auto\Wx\Wx.dll
LoadedModule[24]=C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_2_8_10_uni_gcc_3_4\lib\wxbase28u_gcc_custom.dll
LoadedModule[25]=C:\Windows\syswow64\OLE32.dll
LoadedModule[26]=C:\Windows\syswow64\SHELL32.DLL
LoadedModule[27]=C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_2_8_10_uni_gcc_3_4\lib\wxmsw28u_adv_gcc_custom.dll
LoadedModule[28]=C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_2_8_10_uni_gcc_3_4\lib\wxmsw28u_core_gcc_custom.dll
LoadedModule[29]=C:\Windows\syswow64\COMDLG32.DLL
LoadedModule[30]=C:\Windows\syswow64\OLEAUT32.DLL
LoadedModule[31]=C:\Windows\system32\WINMM.DLL
LoadedModule[32]=C:\Windows\system32\uxtheme.dll
LoadedModule[33]=C:\strawberry\perl\lib\auto\mro\mro.dll
LoadedModule[34]=C:\strawberry\perl\lib\auto\List\Util\Util.dll
LoadedModule[35]=C:\strawberry\perl\lib\auto\Hash\Util\FieldHash\FieldHash.dll
LoadedModule[36]=C:\Windows\system32\dwmapi.dll
FriendlyEventName=Stopped working
ConsentKey=APPCRASH
AppName=perl.exe
AppPath=C:\strawberry\perl\bin\perl.exe

Attachment: test.pl
Description: Binary data

Attachment: MyList.pm
Description: Binary data

Reply via email to