I am new to Gtk programming, please bear with me -:)
I have created GUI using Glade, where I have FileChooserButton(s) called filechooserbutton1, filechooserbutton2，and filechooserbutton3.
Following tutorials, I can compile and run, and see the main window. However, each time I click a button, I get segment fault. Gdb shows the following code are suspectful:
b= (GtkFileChooser *)data->filechooserbutton1;
b= (GtkFileChooser *)data->filechooserbutton2;
b= (GtkFileChooser *)data->filechooserbutton3;
printf("%d: %x\n",i, b[i]);
file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(b[i]));
As the output is:
The question is:
(1) Why didn't the filechooserbutton1 get a correct address?
(2) gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(b)) caused segmentation. But it has an address!