|
From: Salvador O. G. <so...@ms...> - 2008-07-24 04:46:55
|
On Wed, 2008-07-23 at 15:09 -0400, Roode, Eric wrote:
> I just spent the past few hours debugging this. I have narrowed down
> the problem to the scope of the font object.
>
Yes, known bug.
>
> More importantly: Are there any other things that I don't know about
> that are going to bite me if they go out of scope?
Out of my head:
fonts, cursors, menus, icons, bitmaps and accelerators.
> I am trying to make my initialization and setup code modular, so it can
> actually be maintained, instead of one big glomp of spaghetti. This
> sort of behavior does not help.
>
Try to store the perl object in the container window:
sub initiaalize_heading {
my $win = shift;
my $font = ...;
my $lab = $win->AddLabel(...,-font => $font);
# Workaround for window not storing the perl object.
$lab->{_Font} = $font; # I use the '_' prefix to avoid name
# clashes with children.
...
}
|