Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Wx::AuiManager faulting module wxbase294u_gcc_citrusperl.dll, version 2.9.4.0, fault address 0x001d52da.

by Anonymous Monk
on Apr 03, 2013 at 07:54 UTC ( #1026800=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Try it out if you can, report if you get segfault like me (I got itrusperl-standard-51601-msw-x86-017.zip with latest dev bundle), program is translation of http://wiki.wxwidgets.org/WxAUI

Faulting application perl.exe, version 0.0.0.0, faulting module wxbase294u_gcc_citrusperl.dll, version 2.9.4.0, fault address 0x001d52da.

#!/usr/bin/perl -- use strict; use warnings; use Wx; use Wx::AUI; ### http://wiki.wxwidgets.org/WxAUI #~ Faulting application perl.exe, version 0.0.0.0, faulting module wxb +ase294u_gcc_citrusperl.dll, version 2.9.4.0, fault address 0x001d52da +. sub wxT { join'', @_ } sub _ { join'', @_ } my $app = Wx::SimpleApp->new; my $pops= Wx::Frame->new( undef, -1, "pops", [55,55], [55,55], ); $pops->Show; my $this = Wx::Frame->new( $pops, -1, "myframe3", [ -1, -1 ], [ -1, -1 ], Wx::wxDEFAULT_FRAME_STYLE() | Wx::wxTAB_TRAVERSAL() ); { my $m_mgr = Wx::AuiManager->new(); ## // notify wxAUI which frame to use $m_mgr->SetManagedWindow($this); ## // create several text controls my $text1 = Wx::TextCtrl->new( $this, -1, _("Pane 1 - sample text"), Wx::wxDefaultPosition(), Wx::Size->new( ( 200, 150 ) ), Wx::wxNO_BORDER() | Wx::wxTE_MULTILINE() ); my $text2 = Wx::TextCtrl->new( $this, -1, _("Pane 2 - sample text"), Wx::wxDefaultPosition(), Wx::Size->new( ( 200, 150 ) ), Wx::wxNO_BORDER() | Wx::wxTE_MULTILINE() ); my $text3 = Wx::TextCtrl->new( $this, -1, _("Main content window"), Wx::wxDefaultPosition(), Wx::Size->new( ( 200, 150 ) ), Wx::wxNO_BORDER() | Wx::wxTE_MULTILINE() ); ## // add the panes to the manager $m_mgr->AddPane( $text1, Wx::wxLEFT(), wxT("Pane Number One") ); $m_mgr->AddPane( $text2, Wx::wxBOTTOM(), wxT("Pane Number Two") ); $m_mgr->AddPane( $text3, Wx::wxCENTER(), "" ); #~ $m_mgr->AddPane( $text1, Wx::AuiPaneInfo->new->Name( "Pane Numb +er One" )->Left->Position( 1 )->Resizable ); #~ $m_mgr->AddPane( $text2, Wx::AuiPaneInfo->new->Name( "Pane Numb +er Two" )->Bottom->Position( 1 )->Resizable ); #~ $m_mgr->AddPane( $text3, Wx::AuiPaneInfo->new->Name( "Pane Numb +er Three" )->CenterPane->Position( 1 )->Resizable ); ## // tell the manager to "commit" all the changes just made $m_mgr->Update(); } $this->Show; ## memory access violation here $app->MainLoop;

Comment on Wx::AuiManager faulting module wxbase294u_gcc_citrusperl.dll, version 2.9.4.0, fault address 0x001d52da.
Download Code
Re: Wx::AuiManager likes to be kept alive, derive/subclass works better
by Anonymous Monk on Apr 03, 2013 at 08:29 UTC

    Well, I figured it out, $m_mgr goes out of scope, but needs to be kept alive, so this fixes it

    $m_mgr->Update(); $this->{m_mgr} = $m_mgr ; } $this->Show; ## memory access violation here NO MORE $app->MainLoop; $this->{m_mgr}->UnInit(); ## without this its fault address 0x001d4d91 +.

    Subclassing a frame like the original example works better

    Final example

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1026800]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2014-12-21 23:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (109 votes), past polls