GTKRadioButton groups breakage/weirdness



GTKers,
	So, the following code does not work:

GtkWidget *a, *b, *c, *d;
GSList *group = NULL;
a = gtk_radio_button_new_with_label(NULL, "a");
group = gtk_radio_button_group(GTK_RADIO_BUTTON(a));
b = gtk_radio_button_new_with_label(group, "b");
c = gtk_radio_button_new_with_label(group, "c");
d = gtk_radio_button_new_with_label(group, "d");

	Because of the gyrations in gtk_radio_button_set_group, these
buttons end up in different groups.  The following code does work
though:

GtkWidget *a, *b, *c, *d;
GSList *group = NULL;
a = gtk_radio_button_new_with_label(NULL, "a");
group = gtk_radio_button_group(GTK_RADIO_BUTTON(a));
b = gtk_radio_button_new_with_label(group, "b");
group = gtk_radio_button_group(GTK_RADIO_BUTTON(b));
c = gtk_radio_button_new_with_label(group, "c");
group = gtk_radio_button_group(GTK_RADIO_BUTTON(c));
d = gtk_radio_button_new_with_label(group, "d");

	It appears you have to consider your group pointer invalid after
every addition, because of the way the list is recalculated.  This is
non-obvious, and I'd consider broken.  However, simply documenting this
limitation would suffice.  But you have to peruse the source quite
heavily to see where this happens.

Joel


-- 

"Baby, even the losers
 Get luck sometimes.
 Even the losers
 Keep a little bit of pride."

			http://www.jlbec.org/
			jlbec evilplan org



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