Re: assertion



> In function 1, I have created a a dialog widget which has 5 check buttons
> and I am check marking first 2 check buttons.
> The dialog widget is being passed as an argument for this function 2. How
> will I see which check buttons are checked and which are not.
> The declaration for check buttons and dialog widget are global.
> 
> I use in function 2
> int r = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chkbutton2));
> 
> It is always getting 0 for variable r and the following message.
> 
>  Gtk-CRITICAL **: file gtktogglebutton.c: line 326
> (gtk_toggle_button_get_active): assertion `GTK_IS_TOGGLE_BUTTON
> (toggle_button)' failed

You are probably accessing the button *after* the dialog is destroyed
and the button happens to be referred by that dialog only (thus
child widgets get destroyed with the dialog). If you want to keep
the button you have to g_object_ref it or make function-2 a signal
handler of the dialog to set some variable.

marc




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