On Wed, Nov 26, 2003 at 09:30:40PM -0800, Carl B. Constantine wrote: > Ok, I've definately nailed the problem down to an issue with the check > button in my data entry box. But it still doesn't make sense. consider > the following code: > > idRequired = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(customers, "cust_id_req"))); > g_print("ID Required status: %d\n", idRequired); > > toggleTest = (gint)idRequired; > g_print("ID Required status: %d\n", toggleTest); > > the above code prints 0 if the checkbox is unchecked and 1 if it is > checked. > > With that in mind, consider the following additional code: > > sql = g_strconcat("insert into customers (id_req) values('", toggleTest, "')",0L); > > g_print("First sql: %s\n",sql); > > This code prints the following when the checkbox is unchecked: > > insert into customers (id_req) values(' > > so it doesn't even complete the string. That same code crashes with a > segfault 11 if I check the checkbox in the dialog. > > This makes absolutely NO sense what so ever! Well, this seems to make much sense, could it be, that you are passing an Integer into g_strconcat? Try this: char *helper; if(toogleTest) helper = "YES"; else helper = "NO"; sql = g_strconcat("insert into customers (id_req) values('", helper, "')",0L); Basically, in the unchecked case, you are passing 0, which is interpreted as the end of arguments, which makes g_strconcat ignore all further arguments. In the toogleTest == 1 case, it's interpreted as an char pointer, and accessing the address "1" is a relative safe way to segfault an app ;) Andreas Kostyrka _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list