Hi,

Wx::Perl::Packager does not work and has not for some considerable time.
Apologies - it is my fault for 'not eating my own dog food' as far as 
Wx:Perl::Packager is concerned.

The problem - if you use the keyboard whilst you app has the focus, Wx does not 
exit as expected. It and the linked DLLs are still in memory when PDK tries to 
clean up the directory.

If you're a PDK user, you can demonstrate this. Build your package and launch 
it. Provided you don't use the keyboard whilst the app has focus (you can use 
the mouse), it will close down correctly. My tests have been - does the app 
load correctly and does the app shutdown correctly - which, of course, it does.

Use the keyboard, and Wx will not exit when you end the application. I guess 
the keyboard event handling code is creating some objects somewhere that never 
die. (wxIdgets code / wxPErl - I've no idea.)
This doesn't matter when running via perl.exe. The OS will clean up when the 
process exits.

Going forward :

My advice would be not to package the wxWidgets DLLs but distribute them 
separately. You can just place them in the same dir as your executable to have 
it work OK. Or, you can use a '--runlib' with PDK and stick the wxWidgets DLLs 
in there. Never use the '--clean' option and all should work OK.

For anyone who feels the need for a single exec with everything packaged up, I 
shall be issuing an updated Wx::Perl::Packager sometime.

This will extract the 3 wxWidgets DLLs that Wx.dll is linked against to a 
unique temp dir based on the user and application name. If the DLLs are already 
extracted from a previous run - it won't extract them again. There will be no 
attempt at clean up on application shutdown. I will load DLLs before Wx starts.
So as long as the --clean option is not used, PerlApp will not then attempt to 
remove Wx.dll or the wxWidgets DLLs and it won't matter that we are relying on 
OS to clean up on process exit.

This isn't ideal, but if anyone has a better solution just let me know.

The preferred option must be to distribute the wxWidgets dlls separatley. You 
would still need Wx::Perl::Packager to allow PDK to build and to handle loading 
/ unloading of the additional wxWidgets DLLs.


Regards


Mark 


Mark Dootson wrote:
> Hi,
> 
> This is a problem with Wx::Perl::Packager.
> I do not have a fix yet.
> I will post an update when I do.
> 
> Regards
> 
> Mark
> 
> Octavian Rasnita wrote:
>> Hi,
>>
>> I tried this way, but it doesn't change anything.
>> Here is the test program I wrote (the program is included in the message
>> because I don't know if the list supports attachments):
>>
>> use strict;
>> use Wx qw(wxALIGN_RIGHT);
>> use Wx::Event qw(EVT_BUTTON EVT_CLOSE);
>>
>> my $frame = Wx::Frame->new(undef, -1, "The app", [-1,-1], [200,150]);
>>
>> my $panel = Wx::Panel->new($frame, -1);
>>
>> Wx::StaticText->new($panel, -1, "&Fruit:", [20,20], [30,20],
>> wxALIGN_RIGHT);
>>
>> my $fruit = Wx::TextCtrl->new($panel, -1, "", [50,20], [100,20]);
>>
>> my $add = Wx::Button->new($panel, -1, "&Add", [150,20], [50,20]);
>>
>> $add->SetDefault;
>>
>> Wx::StaticText->new($panel, -1, "F&ruits:", [20,60], [30,20],
>> wxALIGN_RIGHT);
>>
>> my $list = Wx::ListBox->new($panel, -1, [50,60], [100,100]);
>>
>> my $del = Wx::Button->new($panel, -1, "&Delete", [150,60], [50,20]);
>>
>> EVT_BUTTON($frame, $add, \&add);
>> EVT_BUTTON($frame, $del, \&del);
>> EVT_CLOSE($frame, \&OnClose);
>>
>> $frame->Show(1);
>> Wx::SimpleApp->new->MainLoop;
>>
>> sub add {
>> my $current_fruit = $fruit->GetValue;
>>
>> if (defined $current_fruit) {
>> $list->Append($current_fruit);
>> $fruit->Clear;
>> }
>> }
>>
>> sub del {
>> my $index = $list->GetSelection;
>> $list->Delete($index) if $index >= 0;
>> }
>>
>> sub OnClose {
>> my ($self, $event) = @_;
>> $self->Destroy();
>> Wx::wxTheApp->ExitMainLoop();
>> }
>>
>> Octavian
>>
>> ----- Original Message ----- From: "Huub Peters" <[EMAIL PROTECTED]>
>> To: "Octavian Rasnita" <[EMAIL PROTECTED]>; "Mark Dootson"
>> <[EMAIL PROTECTED]>; <[email protected]>
>> Sent: Monday, November 19, 2007 1:01 PM
>> Subject: Re: temporary files
>>
>>
>>>> If I close the app using alt+F4, the app closes, but do I need to handle
>>>> that close event and close() or destroy() something in that close
>>>> handler?
>>> I've mentioned this before in reply to a similar message.
>>> This has helped me in the past (many, many versions ago) and I think it's
>>> worth a try:
>>>
>>> EVT_CLOSE($self, \&OnClose );
>>>
>>> sub OnClose {
>>>  my( $self, $event ) = @_;
>>>  $self->Destroy();
>>>  Wx::wxTheApp()->ExitMainLoop;
>>> }
>>>
>>> Please let us know if it makes any difference.
>>>
>>> Cheers,
>>> Huub Peters
>>>
> 
> 


Reply via email to