Re: Dialog destruction signals.



Farooq Mela <f_mela@yahoo.com> writes:
> I am having some very strange problems concerning the
> execution of signal handlers upon the destruction of a
> non-modal dialog. Here is the relevant code:
>

Someone already answered most of this, but a couple comments...

> static gint
> on_dialog_delete(GtkWidget *widget, gpointer data)

Note that you can't connect this handler to "destroy" because a
handler for destroy shouldn't return a value. You need a destroy
handler that returns void.

> to. The delete_event signal, according to
> documentation, should be emitted before the destroy
> signal, and the emission of the destroy signal should
> be dependant upon the return value of the signal
> handler associated with the delete_event signal. In my

Note that delete_event just means the window manager asked the dialog
to be closed, so it isn't always emitted; you could call
gtk_widget_destroy() yourself before the window manager asks this.


> assertation failure. However, when connecting to the
> `destroy' signal, the dialog appears to be destroyed,
> before the dialog box from the `yesnocancel_dialog'
> function appears. But in reality it is only hidden,
> because the contents of the GtkText in that dialog can
> be saved from the signal handler!
>

destroy is not the same as
finalize. http://developer.gnome.org/doc/GGAD has some information on
this, read the GtkObject chapter. 

Essentially the refcount is not 0, so you can still access the
widgets.

In GTK 1.4 destroy can even be emitted more than once, weirdly enough.

Havoc




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