Hello,
this is my second post today, and its the second question.
I've got a programm, which creates a seg fault after some days. I dont know, where this fault is generated.
Now i tried to analyse the programm. Therefore i used purify. And now the problem beginns.
With purify i get thousands and thousands of "Uninitialized memory read" errors.
But those errors seem to be in the gtk library.
I will post here a function which creates such errors, maybe somebody had the same problem and knows, how to solve it.
Code:
static GtkWidget *get_search_area () {
GtkWidget *input_field;
GtkWidget *search_button;
GtkWidget *hboxSearch;
GList *glist = NULL;
// input field
input_field = gtk_entry_new_with_max_length(5);
gtk_entry_set_width_chars(GTK_ENTRY(input_field), 5);
//combobox
combo_box = gtk_combo_new();
glist = g_list_append (glist, "All");
glist = g_list_append (glist, "K15-U");
search_button = gtk_button_new_with_label ("Update Users");
g_signal_connect (G_OBJECT (search_button), "clicked",
G_CALLBACK (update_button), input_field);
gtk_widget_set_size_request (GTK_WIDGET (search_button), 80, 20);
gtk_widget_show (input_field);
gtk_widget_show (combo_box);
gtk_widget_show (search_button);
hboxSearch = gtk_hbox_new (FALSE, 20);
gtk_box_pack_start (GTK_BOX (hboxSearch), input_field, FALSE, TRUE, 5); //This line is reported by purify
gtk_box_pack_start (GTK_BOX (hboxSearch), combo_box, FALSE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hboxSearch), search_button, FALSE, TRUE, 0);
gtk_widget_show(hboxSearch);
return hboxSearch;
}
Here is the purify output of this function:
Code:
This is occurring while in:
gtk_hbox_size_allocate [libgtk-x11-2.0.so.0]
g_closure_invoke [libgobject-2.0.so.0]
signal_emit_unlocked_R [libgobject-2.0.so.0]
g_signal_emit_valist [libgobject-2.0.so.0]
gtk_signal_emit [libgtk-x11-2.0.so.0]
gtk_widget_size_allocate [libgtk-x11-2.0.so.0]
Reading 4 bytes from 0x11ec84 in the heap (1 byte at 0x11ec87 uninit).
Address 0x11ec84 is 4 bytes into a malloc'd block at 0x11ec80 of 8 bytes.
This block was allocated from:
malloc [rtlib.o]
g_malloc [libglib-2.0.so.0]
gtk_box_pack_start [libgtk-x11-2.0.so.0]
get_search_area [MainWindow.c:256]
gtk_widget_show (search_button);
// hbox to put the search button and input field in
hboxSearch = gtk_hbox_new (FALSE, 20);
=> gtk_box_pack_start (GTK_BOX (hboxSearch), input_field, FALSE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hboxSearch), combo_box, FALSE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hboxSearch), search_button, FALSE, TRUE, 0);
I hope anybody knows this behaviour of gtk or my code, because i haven't got a clue.
Thank you