GtkClist crashing when elements = 0;



GtkClist is crashing on me when it doesn't have any elements.
Is this a know problem ? Or am I missing something ?

Here is the backtrace where it is crashing :
========================================
0x405dc489 in __wait4 () from /lib/libc.so.6
#0  0x405dc489 in __wait4 () from /lib/libc.so.6
#1  0x4063a48c in __DTOR_END__ () from /lib/libc.so.6
#2  0x4008060f in gnome_segv_handle (signum=11) at gnome-init.c:655
#3  0x4056a408 in __restore ()
    at ../sysdeps/unix/sysv/linux/i386/sigaction.c:127
#4  0x40175aab in vadjustment_value_changed (adjustment=0x816bcd8, 
    data=0x816d7a8) at gtkclist.c:6211
#5  0x401c125d in gtk_marshal_NONE__NONE () at gtkmarshal.c:470
#6  0x401ee9ed in gtk_handlers_run (handlers=0x8148428,
signal=0xbfffed5c, 
    object=0x816bcd8, params=0xbfffeda4, after=0) at gtksignal.c:1917
#7  0x401ede32 in gtk_signal_real_emit (object=0x816bcd8, signal_id=97, 
    params=0xbfffeda4) at gtksignal.c:1477
#8  0x401ec259 in gtk_signal_emit_by_name () at gtksignal.c:234
#9  0x401753d2 in adjust_adjustments (clist=0x816d7a8, block_resize=0)
    at gtkclist.c:6074
#10 0x401750be in clist_refresh (clist=0x816d7a8) at gtkclist.c:5997
#11 0x4016a7ad in gtk_clist_thaw () at gtkclist.c:1190
[....]
----------------

the code that is causing this problem is :

-------------------------------------------
static void
gedit_plugin_manager_item_add_all (GtkWidget *widget, gpointer data)
{
	gint row, rows, new_row;
	gchar *name;
	gchar *name_array[1];
	gpointer item_data;

	gedit_plugin_manager_lists_freeze();

	rows = GTK_CLIST(available_list)->rows;

	g_print ("rows %i\n", rows);
	
	for (row = 0; row < rows; row++)
	{
		gtk_clist_get_text (GTK_CLIST (available_list), 0, 0, &name);
		g_print ("name : %s\n", name);
		item_data = gtk_clist_get_row_data (GTK_CLIST(available_list), 0);

		name_array[0] = g_strdup(name);
		gtk_clist_remove (GTK_CLIST (available_list), 0);

		new_row = gtk_clist_append (GTK_CLIST (installed_list), name_array);
		gtk_clist_set_row_data (GTK_CLIST (installed_list), new_row,
item_data);
	}

	gedit_plugin_manager_lists_thaw (GTK_WIDGET(data));
------------------------------------------------
If I change the for loop to :

	for (row = 1; row < rows; row++)

so that it always leave an item in the list, it doesn't crash.


Thanks For your help.

chema

so that




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]