Hello, Jeremy!

In my main application I'm forced to have several controls with same name, 
because the UI is actually loads from network upon some sort of 
action. So the names are like Button001, Button002, ...etc. And when new UI 
arrives I need to get rid from all existing controls (i.e. 
ButtonNNN, LabelNNN etc) and create new ones. So I used 
Win32::GUI::DestroyWindow to remove control. But in first memleak example you 
told me 
that Win32::GUI::DestroyWindow is not necessary, I tried without it and got a 
complete mess - most of new controls just did not show up as 
shown in example below in quoted message (this is I beleive Win32::GUI bug)

As for memory leak - it seems it is perl 5.10 bug, I'll install 5.8.xx to 
confirm.

-----Original Message-----
From: Jeremy White <jez_wh...@hotmail.com>
To: <war...@mail.ru>, <ilya.bando...@socgen.com>,
<perl-win32-gui-users@lists.sourceforge.net>
Date: Thu, 24 Dec 2009 23:01:41 +0000
Subject: RE: [perl-win32-gui-users] label is not visible after recreating
inevent

> 
> Hi,
> The reason you are seeing strange behavior is that you have several controls 
> with the same name, give each one a unique name and the 
problem will go away. 
> For me (Vista, Perl 5.8.9, Win32::GUI 1.6) the below doesn't leak (handle or 
> memory [i do see a 'leak' of 16K on the first run, but no more 
leaks on any other run after])
> use strict; use Win32::GUI qw (WM_QUERYENDSESSION); my $main = 
> Win32::GUI::Window->new(-name => 'Main', -text => 'Perl', -width => 200, -
height => 200);$main->AddLabel(-name => "Label", -text => "Hello, world", -left 
=> 20, -top => 20, -notify => 1);$main-
>Show();Win32::GUI::Dialog(); 
> sub Label_Click {  for (1..10000) {    $main->AddLabel(-name => "Label", 
> -text => "Hello, world", -left => 20, -top => 20, -notify => 1);  
}}
> 
> 
> 
> > From: war...@mail.ru
> > To: ilya.bando...@socgen.com; perl-win32-gui-users@lists.sourceforge.net
> > Date: Thu, 24 Dec 2009 19:10:51 +0300
> > Subject: Re: [perl-win32-gui-users] label is not visible after recreating 
> > inevent
> > 
> > 
> > Well, in my main application I need dynamically destroy/create controls. 
> > But I was told to not use DestroyWindow, because Win32::GUI 
"correctly" destroys control when it goes out of scope. I decided to check how 
Win32::GUI destroys controls when they are out of scope and 
wrote an example below. I do not need workaround (I already have one), I need a 
confirmation if it is a bug or not (if not, then why the 
behavior is so strange?). Try to comment one of $main->AddLabel in Label_Click 
and everything will be ok. This is very strange behavior, I 
think.
> > 
> > It seems the program hangs in infinite loop invoking 
> > Win32::GUI::WindowProps::FETCH but I'm not yet digged deep enough to be 
> > 100% sure...
> > 
> > -----Original Message-----
> > From: "Ilya BANDORIN" <ilya.bando...@socgen.com>
> > To: "perl-win32-gui-users" <perl-win32-gui-users@lists.sourceforge.net>
> > Date: Thu, 24 Dec 2009 18:53:36 +0300
> > Subject: Re: [perl-win32-gui-users] label is not visible after recreating
> > inevent
> > 
> > > Probably because the control named "Label" is alredy defined in main 
> > > code. Why do you try to create it once more?
> > > You should just modify its properties (text), something like this:
> > > 
> > > $main->Label->Text(rand());
> > > 
> > > 
> > > 
> > > -----Original Message-----
> > > From: Andrey [mailto:war...@mail.ru] 
> > > Sent: Thursday, December 24, 2009 6:07 PM
> > > To: perl-win32-gui-users
> > > Subject: [perl-win32-gui-users] label is not visible after recreating 
> > > inevent
> > > 
> > > 
> > > While researching memory leak in Win32::GUI I found out strange behavior 
> > > of control.
> > > 
> > > Here is an example:
> > > 
> > > =====================
> > > use strict; 
> > > use Win32::GUI(); 
> > > 
> > > my $main = Win32::GUI::Window->new(-name => 'Main', -text => 'Perl', 
> > > -width => 200, -height => 200);
> > > 
> > > $main->AddLabel(-name => "Label", -text => "Hello, world", -left => 20, 
> > > -top => 20, -notify => 1);
> > > 
> > > sub Label_Click 
> > > { 
> > >   { # "visibility" block
> > >     $main->AddLabel(-name => "Label", -text => rand(), -left => 20, -top 
> > > => 20, -notify => 1); 
> > >     $main->AddLabel(-name => "Label", -text => rand(), -left => 20, -top 
> > > => 20, -notify => 1); 
> > >   }
> > >   $main->AddLabel(-name => "Label", -text => rand(), -left => 20, -top => 
> > > 20, -notify => 1); 
> > > } 
> > > 
> > > $main->Show(); Win32::GUI::Dialog(); 
> > > 
> > > sub Main_Terminate { -1; }
> > > =======================
> > > 
> > > When you click on "Hello, world" label it just disappears.
> > > If you comment any of "$main->AddLabel" lines then everything will be OK.
> > > Why label disappears?
> > > 
> > > Perl version: 5.10.1 build 1006
> > > Win32::GUI version: 1.06
> > > 
> > > 
> > > ------------------------------------------------------------------------------
> > > This SF.Net email is sponsored by the Verizon Developer Community
> > > Take advantage of Verizon's best-in-class app development support
> > > A streamlined, 14 day to market process makes app distribution fast and 
> > > easy
> > > Join now and get one step closer to millions of Verizon customers
> > > http://p.sf.net/sfu/verizon-dev2dev 
> > > _______________________________________________
> > > Perl-Win32-GUI-Users mailing list
> > > Perl-Win32-GUI-Users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> > > http://perl-win32-gui.sourceforge.net/
> > > ------------------------------------------------------------------------------
> > > This SF.Net email is sponsored by the Verizon Developer Community
> > > Take advantage of Verizon's best-in-class app development support
> > > A streamlined, 14 day to market process makes app distribution fast and 
> > > easy
> > > Join now and get one step closer to millions of Verizon customers
> > > http://p.sf.net/sfu/verizon-dev2dev 
> > > _______________________________________________
> > > Perl-Win32-GUI-Users mailing list
> > > Perl-Win32-GUI-Users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> > > http://perl-win32-gui.sourceforge.net/
> > > 
> > 
> > ------------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Verizon Developer Community
> > Take advantage of Verizon's best-in-class app development support
> > A streamlined, 14 day to market process makes app distribution fast and easy
> > Join now and get one step closer to millions of Verizon customers
> > http://p.sf.net/sfu/verizon-dev2dev 
> > _______________________________________________
> > Perl-Win32-GUI-Users mailing list
> > Perl-Win32-GUI-Users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> > http://perl-win32-gui.sourceforge.net/
>                                         
> _________________________________________________________________
> Have more than one Hotmail account? Link them together to easily access both
>  http://clk.atdmt.com/UKM/go/186394591/direct/01/
> 

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to