Any ideas for troubleshooting this gtk error?
by hazel from LinuxQuestions.org on (#52ZJH)
I have a program that helps me do sudokus, the fiendish kind where you have to make a guess at some point and then backtrack if it leads to contradictions.
The puzzle is represented by a grid of gtk buttons. You add the numbers from the keyboard onto buttons focused by the mouse. Original numbers appear in black, entered numbers in green and a guess in red. If a guess doesn't work, you can revert to the preceding state. I've also included a check algorithm that highlights an illegally matching value in magenta. In a paper sudoku, you can easily enter a contradictory value without noticing it.
What happens sometimes after entering guess mode is that every subsequent entry triggers an error message: sudoku_aid:2311 Gtk_CRITICAL 1A_gtk_widget_modify_bg assertion 'GTK_IS_WIDGET(widget)' failed.
Although this is called a critical error, the program doesn't crash, but I'd like to know what the problem is. It must be associated with the checking algorithm for illegal entries because this is the only part of the program that attempts to change a background. Specifically it changes the background of the event box which is the child of a matching button; the numeric label is the child of this event box.
Here is the code for this function:
Code:GtkWidget *flash (GtkWidget *eventbox, gboolean onoff)
{
GdkColor color;
if (gdk_color_parse ("magenta", &color))
{
if (onoff)
{
gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, &color);
return (eventbox);
}
else
{
gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, NULL);
return (NULL);
}
}
}Given that this is an intermittent problem, how to I find out what triggers it? Specifically what does the number 2311 refer to?


The puzzle is represented by a grid of gtk buttons. You add the numbers from the keyboard onto buttons focused by the mouse. Original numbers appear in black, entered numbers in green and a guess in red. If a guess doesn't work, you can revert to the preceding state. I've also included a check algorithm that highlights an illegally matching value in magenta. In a paper sudoku, you can easily enter a contradictory value without noticing it.
What happens sometimes after entering guess mode is that every subsequent entry triggers an error message: sudoku_aid:2311 Gtk_CRITICAL 1A_gtk_widget_modify_bg assertion 'GTK_IS_WIDGET(widget)' failed.
Although this is called a critical error, the program doesn't crash, but I'd like to know what the problem is. It must be associated with the checking algorithm for illegal entries because this is the only part of the program that attempts to change a background. Specifically it changes the background of the event box which is the child of a matching button; the numeric label is the child of this event box.
Here is the code for this function:
Code:GtkWidget *flash (GtkWidget *eventbox, gboolean onoff)
{
GdkColor color;
if (gdk_color_parse ("magenta", &color))
{
if (onoff)
{
gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, &color);
return (eventbox);
}
else
{
gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, NULL);
return (NULL);
}
}
}Given that this is an intermittent problem, how to I find out what triggers it? Specifically what does the number 2311 refer to?