Mon Dec 03 20:58:18 2012: Request 81670 was acted upon. Transaction: Correspondence added by mark.doot...@znix.com Queue: Wx Subject: Re: [rt.cpan.org #81670] Wx::Frame weaken away when ->Close() Broken in: (no value) Severity: (no value) Owner: Nobody Requestors: use...@zip.com.au Status: new Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=81670 >
On 03/12/2012 21:48, Kevin Ryde via RT wrote: > 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