Re: Closing a window - reopening failure
| From: | James Cameron | Date: | Thu, 21 Nov 2002 01:25:01 +0000 |
| Subject: | Re: Closing a window - reopening failure | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2687@lists.php.net to get a copy of this message | ||
On Thu, Nov 21, 2002 at 02:04:33AM +0100, erbel@submedia.de wrote:
> $w2->connect('destroy','killwin2');
>
> function killwin2() {
> GLOBAL $w1,$w2,$w3,$w4,$w5,$w6;
> $w2->get_toplevel;
> $w2->hide();
> }
'destroy' is called when it is destroyed. If it is destroyed, it
ceases to exist. Any pointers you still have are officially invalid.
> I mean I destroy it, but what else signal can I put on a toplevel window
> to close it?
'delete_event' signal.
> I reopen it and call show_all() on $w2
Therefore you're trying to do something on a widget whose children have
all been destroyed, and what you reported is expected. The heap memory
for the toplevel window has also probably been freed.
Basically, once a widget has been destroyed, you can't do anything more
with it. Create a new one. To avoid destruction, catch the
'delete_event' signal, and (not sure) return a status asking for
non-destruction. The 'delete_event' handler would hide().
--
James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/