Skip Menu |

This queue is for tickets about the Wx CPAN distribution.

Report information
The Basics
Id: 81670
Status: rejected
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: Wx::Frame weaken away when ->Close()
Date: Tue, 04 Dec 2012 08:48:58 +1100
To: bug-Wx [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Under a gtk build, a Wx::Frame $frame->Close seems to be enough to make the $frame object weaken away. The program foo.pl below prints "undef". Under mswin it looks like that might not be so. Ie. the foo.pl would print a Wx::Frame object, not undef. Alas I don't have an mswin to try, so this is just based on cpantesters failures I had in a pod browser main window. Is a $frame->Close meant to be enough for the object to weaken away? Or have I misunderstood Close() vs Destroy() methods?
use 5.008; use strict; use warnings; use Scalar::Util; use Wx; my $app = Wx::SimpleApp->new; my $frame = Wx::Frame->new; $frame->Show; $frame->Close; $app->Yield; Scalar::Util::weaken ($frame); print $frame||'undef',"\n";
Subject: Re: [rt.cpan.org #81670] Wx::Frame weaken away when ->Close()
Date: Tue, 04 Dec 2012 01:57:45 +0000
To: bug-Wx [...] rt.cpan.org
From: Mark Dootson <mark.dootson [...] znix.com>
On 03/12/2012 21:48, Kevin Ryde via RT wrote: Show quoted text
> Under a gtk build, a Wx::Frame $frame->Close seems to be enough to make > the $frame object weaken away. The program foo.pl below prints "undef". > > Under mswin it looks like that might not be so. Ie. the foo.pl would > print a Wx::Frame object, not undef. > > Alas I don't have an mswin to try, so this is just based on cpantesters > failures I had in a pod browser main window. > > Is a $frame->Close meant to be enough for the object to weaken away? > Or have I misunderstood Close() vs Destroy() methods?
$frame->Close simply generates an EVT_CLOSE so it all depends what is in your (or the default) EVT_CLOSE handler. To remove a top level window from the application, use $frame->Destroy - but note that as it says in the wxWidgets docs, window destruction will take place a some point - not necessarily 'now'. So I would guess that you have misunderstood "$frame->Destroy". Probably because "Destroy" is an odd name for a method that closes the frame gracefully after ensuring all events are handled etc. :-) Regards Mark
Subject: Re: [rt.cpan.org #81670] Wx::Frame weaken away when ->Close()
Date: Fri, 07 Dec 2012 09:25:45 +1100
To: bug-Wx [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
"Mark Dootson via RT" <bug-Wx@rt.cpan.org> writes: Show quoted text
> > $frame->Close simply generates an EVT_CLOSE so it all depends what is in > your (or the default) EVT_CLOSE handler.
Thanks, I'll do a destroy from there ... I think I want to destroy on close if that's not already the default. Seems subtle that it should vary between gtk and mswin, but that would be wx rather than perl presumably.
I have closed the ticket, if that is OK, as this isn't really a bug. Many thanks On Thu Dec 06 17:26:09 2012, user42@zip.com.au wrote: Show quoted text
> "Mark Dootson via RT" <bug-Wx@rt.cpan.org> writes:
> > > > $frame->Close simply generates an EVT_CLOSE so it all depends what
is in Show quoted text
> > your (or the default) EVT_CLOSE handler.
> > Thanks, I'll do a destroy from there ... I think I want to destroy on > close if that's not already the default. Seems subtle that it should > vary between gtk and mswin, but that would be wx rather than perl > presumably.