[Glade-users] GtkClist Problem (Seg fault)

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


(project2:30722): Gtk-CRITICAL **: gtk_object_set: assertion
`GTK_IS_OBJECT (object)' failed

(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);

 cols = mysql_num_fields(res_str);

 clist1 = gtk_clist_new (cols);
            "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.


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]