Fix incorrect usage of gtk_radio_button_new_with_label()/gtk_radio_button_get_group();

Use gtk_radio_button_new_with_label_from_widget().

Essentially: gtk_radio_button_get_group() must be called after each gtk_radio_button_new...()
before using the 'group' GSList pointer in another call to gtk_radio_button_new...().

In these cases the incorrect usage appears to only have resulted in allowing multiple
radio buttons to be activated simultaneously.

(In at least one case elsewhere, the incorrect usage resulted in a Wireshark crash).



svn path=/trunk/; revision=37869
This commit is contained in:
Bill Meier 2011-07-02 21:00:56 +00:00
parent 0f310b83fe
commit a2e7e3e2e7
1 changed files with 8 additions and 14 deletions

View File

@ -2034,7 +2034,6 @@ static void save_csv_as_cb(GtkWidget *bt _U_, gpointer data)
GtkWidget *table1;
GtkWidget *label_format;
GtkWidget *channels_label;
GSList *channels_group = NULL;
GtkWidget *forward_rb;
GtkWidget *reversed_rb;
GtkWidget *both_rb;
@ -2086,19 +2085,18 @@ static void save_csv_as_cb(GtkWidget *bt _U_, gpointer data)
gtk_misc_set_alignment (GTK_MISC (channels_label), 0, 0.5f);
forward_rb = gtk_radio_button_new_with_label (NULL, "forward ");
channels_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (forward_rb));
gtk_widget_show (forward_rb);
gtk_table_attach (GTK_TABLE (table1), forward_rb, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
reversed_rb = gtk_radio_button_new_with_label (channels_group, "reversed ");
reversed_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(forward_rb), "reversed ");
gtk_widget_show (reversed_rb);
gtk_table_attach (GTK_TABLE (table1), reversed_rb, 2, 3, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
both_rb = gtk_radio_button_new_with_label (channels_group, "both");
both_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(forward_rb), "both");
gtk_widget_show (both_rb);
gtk_table_attach (GTK_TABLE (table1), both_rb, 3, 4, 1, 2,
(GtkAttachOptions) (GTK_FILL),
@ -2671,8 +2669,6 @@ static void save_voice_as_cb(GtkWidget *bt _U_, gpointer data)
GtkWidget *table1;
GtkWidget *label_format;
GtkWidget *channels_label;
GSList *format_group = NULL;
GSList *channels_group = NULL;
GtkWidget *forward_rb;
GtkWidget *reversed_rb;
GtkWidget *both_rb;
@ -2733,14 +2729,13 @@ static void save_voice_as_cb(GtkWidget *bt _U_, gpointer data)
gtk_misc_set_alignment (GTK_MISC (label_format), 0, 0.5f);
raw_rb = gtk_radio_button_new_with_label (NULL, ".raw");
format_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (raw_rb));
gtk_widget_show (raw_rb);
gtk_table_attach (GTK_TABLE (table1), raw_rb, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
au_rb = gtk_radio_button_new_with_label (format_group, ".au");
au_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(raw_rb), ".au");
gtk_widget_show (au_rb);
gtk_table_attach (GTK_TABLE (table1), au_rb, 3, 4, 0, 1,
(GtkAttachOptions) (GTK_FILL),
@ -2748,20 +2743,20 @@ static void save_voice_as_cb(GtkWidget *bt _U_, gpointer data)
#if 0
/* we support .au - ulaw*/
wav_rb = gtk_radio_button_new_with_label (format_group, ".wav");
wav_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(raw_rb), ".wav");
format_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (wav_rb));
gtk_widget_show (wav_rb);
gtk_table_attach (GTK_TABLE (table1), wav_rb, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
sw_rb = gtk_radio_button_new_with_label (format_group, "8 kHz, 16 bit ");
sw_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(raw_rb), "8 kHz, 16 bit ");
format_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (sw_rb));
gtk_widget_show (sw_rb);
gtk_table_attach (GTK_TABLE (table1), sw_rb, 2, 3, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
au_rb = gtk_radio_button_new_with_label (format_group, ".au");
au_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(raw_rb), ".au");
format_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (au_rb));
gtk_widget_show (au_rb);
gtk_table_attach (GTK_TABLE (table1), au_rb, 3, 4, 0, 1,
@ -2777,19 +2772,18 @@ static void save_voice_as_cb(GtkWidget *bt _U_, gpointer data)
gtk_misc_set_alignment (GTK_MISC (channels_label), 0, 0.5f);
forward_rb = gtk_radio_button_new_with_label (NULL, "forward ");
channels_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (forward_rb));
gtk_widget_show (forward_rb);
gtk_table_attach (GTK_TABLE (table1), forward_rb, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
reversed_rb = gtk_radio_button_new_with_label (channels_group, "reversed ");
reversed_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(forward_rb), "reversed ");
gtk_widget_show (reversed_rb);
gtk_table_attach (GTK_TABLE (table1), reversed_rb, 2, 3, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
both_rb = gtk_radio_button_new_with_label (channels_group, "both");
both_rb = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(forward_rb), "both");
gtk_widget_show (both_rb);
gtk_table_attach (GTK_TABLE (table1), both_rb, 3, 4, 1, 2,
(GtkAttachOptions) (GTK_FILL),