|
From: Andrey <wa...@ma...> - 2009-12-24 15:07:16
|
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
|