I'm trying to get a pretty simple UI working with GTK+. I think I'm running into some issues pertaining to C and pass-by-reference.
Here is some code from my main:
...
GtkWidget *controlArea;
GtkWidget *sendButton;
GtkWidget *createAccountButton;
GtkWidget *textBox;
...
controlArea = create_control_area(sendButton, createAccountButton, textBox);
...
g_signal_connect(sendButton, GTK_CALLBACK(send), textBox);
g_signal_connect(createAccountButton, GTK_CALLBACK(createAccount), NULL);
...
And here is some code from the create_control_area()
function:
...
textBox = gtk_text_view_new();
...
sendButton = gtk_button_new_with_label("Send Message");
createAccount = gtk_button_new_with_label("Create Account");
...
The Text View and Buttons are attached to a widget which is then returned by that function. My two callback methods both exist but are currently empty. When I run the program, I reach a segfault on the g_signal_connect()
calls (either of them will do it). I tested in gdb and it seemed to indicate all three widgets, textBox, sendButton, and createAccount were valid, but I'm not sure. Any ideas?