Re: delete-event of GtkWidget



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Jan 20, 2007 at 03:52:24PM +0100, Enrico TrÃger wrote:
On Sat, 20 Jan 2007 05:34:27 +0000, tomas tuxteam de wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Jan 19, 2007 at 06:52:03PM +0100, Enrico TrÃger wrote:
Hi all,

when I write big dialogs, I create it only once, keep the pointer to
the dialog [...]
[...]
I didn't understand exactly. Do you mean that you *don't* handle the
delete event [...]

I connected to the delete-event and registered gtk_widget_hide as
callback.

Ah-hah. Now I think I got it.

          Re-showing(gtk_widget_show) worked in Debian and crashed in
PuppyLinux. Now, I register gtk_widget_hide_on_delete as callback and
then the widget won't be destroyed and all is fine.

So basically it boils down to the difference in behaviour between
gtk_widget_hide() (used as a callback for the delete event) and
gtk_widget_hide_on_delete(). Did I get it right this time?

Note that the delete event *wants* a callback returning a boolean. If it
returns TRUE, the following chain of events leading to the widget's
destruction is stopped (this is what you want). OTOH gtk_widget_hide()
is declared as a VOID. If the caller tries to call it as a boolean, bets
are up whether it sees TRUE or FALSE. It might be very architecture,
compiler (and may be moon phase) dependent.

OTOH Yeti's interpretation is at least as likely: the widget gets
destroyed anyway, but its guts still lie around on the heap, so it is
seemingly functional.

Regards
- -- tomÃs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFs1uNBcgs9XrR2kYRAj9uAJkB0rY9KrPZfoYl1+HrRk92z5E+2gCbBJ4R
G8NBP+tF6soosPWg0xkv4TU=
=hkV3
-----END PGP SIGNATURE-----




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]