Re: gtk_widget_destroy on_buttoncancel_cliked and g_free interaction causing issues.



Hi.

So, I put it in the on_buttonclose_clicked callback, passing in "this".
I use the on_buttonclose_clicked callback for both the buttonclose
clicked signal, and the window destroyed signal.

One resolution would probably be to connect button clicked signal to
different handler that would only trigger destroy event. Than you can
do any freeing of structures in destroy event handler.

--- CODE ---
g_signal_connect_swaped( G_OBJECT( this->close_button ), "clicked",
                         G_CALLBACK( gtk_widget_destroy ), this->dialog );
g_signal_connect( G_OBJECT( this->dialog ), "destroy",
                  G_CALLBACK( on_dialog_destroy ), this );

static void
on_dialog_destroy( GtkObject *window,
                   MyStruct  *this )
{
    if( this )
        g_free( this );
}
--- CODE ---

I hope this will help (and work;), since I don't have compiler at hand
to test it.

-- 
Tadej BorovÅak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com



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