On Saturday 15 July 2006 10:56, ReneeB wrote:
> Hi,
>
> Tk::Tree isn't destroyed because it inherits from Tk::Derived not from
> Tk::Widget.
> I'll try to release a new Tk::Tree version today.
>
> ReneeB
Ok, thanks. I'm still confused:
Tk:Tree has: use base qw(Tk::Derived Tk::HList);
Tk::HList has: use base qw(Tk::Widget);
so it shouldn't really matter, right?
Anyway, removing Tk::Tree from the demo doesn't fix it for other widgets (like
the default button and all the frames of DialogBox), although it is a widget
based on Tk::Tree I'm actually having in the real app.
>
> Petr Pajas schrieb:
> > Hi,
> >
> > I have a dialog box which I cannot easily reuse, so it is created many
> > times during the application run. After creating it, I can't find a way
> > to destroy it completely even if I explicitly call $d->destroy
> >
oh, *and* was missing here
> > all variables go out of scope. Here is a demo:
-- Petr
> > #!/usr/bin/perl
> > use strict;
> > $|=1;
> > {
> > use Tk;
> > use Tk::Tree;
> >
> > my $mw = MainWindow->new;
> >
> > *Tk::Widget::DESTROY = sub {
> > my $w = shift;
> > print "DESTROYING $w\n";
> > $w->destroy if ($w->IsWidget);
> > };
> >
> > {
> > for (1..3) {
> > print "===================================\n";
> > print "RUN $_\n";
> > print "===================================\n";
> > my $d=$mw->DialogBox(-title=> "test",
> > -buttons=> ["OK", "Cancel"]);
> > # only the Cancel button will get destroyed
> >
> > my $edit1 = $d->HList(); # will get destroyed
> > my $edit2 = $d->Tree(); # won't get destroyed
> > $d->destroy;
> > # will destroy only Tk::Button a Tk::HList
> > sleep 0.1;
> > }
> > }
> > # MainLoop;
> > }
> >
> > END {
> > print "===================================\n";
> > print "STARTING GLOBAL DESTRUCTION\n";
> > print "===================================\n";
> > # will destroy everything else
> > }
> >
> > __END__
> >
> > Is there any way to prevent the leak? Thanks,
> > -- Petr
> > --++**==--++**==--++**==--++**==--++**==--++**==--++**==
> > ptk mailing list
> > ptk@xxxxxxxxxxxxxxxxxx
> > https://mailman.stanford.edu/mailman/listinfo/ptk
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
ptk@xxxxxxxxxxxxxxxxxx
https://mailman.stanford.edu/mailman/listinfo/ptk
|