[Glade-users] GtkClist Problem (Seg fault)
- From: tristan.van.berkom at gmail.com (Tristan Van Berkom)
- Subject: [Glade-users] GtkClist Problem (Seg fault)
- Date: Thu Jun 1 22:34:36 2006
guillaume ruch infini fr wrote:
Hello all,
I've Got a problem with creayion of a GtkClist.... I'm developping a small
mysql interface which only deals withs 3 tables. I've got 3 buttons which
may build each a dynamic clist to display the content of the selected
table in the same widget. When I compile it, it returns :
(project2:1390): Gtk-CRITICAL **: gtk_object_set_data_full: assertion
`GTK_IS_OBJECT (object)' failed
Erreur de segmentation
gtk_clist_new...OK
(project2:30722): Gtk-CRITICAL **: gtk_object_set: assertion
`GTK_IS_OBJECT (object)' failed
gtk_object_set_data_full...OK
(project2:30722): Gtk-CRITICAL **: gtk_object_set_data_full: assertion
`GTK_IS_OBJECT (object)' failed
Erreur de segmentation
The Widget is called dyn_clist and is called by an event on the button
"CLients" Here's the code :
GtkWidget *dyn_clist (gchar *nom_table)
{
GtkWidget *Stox_main;
GtkWidget *scrolledwindow1;
GtkWidget *clist1;
GtkWidget *label;
gint i;
gint cols = 3;
gchar *sql;
MYSQL_RES *res_str;
MYSQL_ROW db_row;
MYSQL_FIELD *field;
gchar *row[15] = {"", "", "", "", "",
"", "", "", "", "",
"", "", "", "", ""};
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow1);
sql = g_strconcat("select * from ", nom_table, 0L);
g_print("sql is: %s\n", sql);
if (mysql_query (conn, sql) != 0)
{
g_print("Echec de la requete...\n");
return 0L;
}
res_str = mysql_store_result (conn);
g_print("mysql_store_result...OK\n");
cols = mysql_num_fields(res_str);
clist1 = gtk_clist_new (cols);
/*gtk_object_set_data_full(GTK_OBJECT(Stox_main),
"clist1", clist1,
0L); */
You are calling gtk_object_set_data_full() on Stox_main, and Stox_main here
is an uninitialized pointer, so you are feeding random addresses to tha api.
Cheers,
-Tristan
PS: gtk_object_* is deprecated, use g_object_* instead. GtkCList is also
deprecated and unsupported, you should use treeviews instead.
deprecated stuff is marked as such in the api docs: http://www.gtk.org/api/
PPS: afaiac you are welcome to ask gtk+ related questions here but you'll
have a greater audience in the gtk application list:
gtk-app-devel-list gnome org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]