Help



        My name is Nicolae Tabusca and I am student of Faculty of Computer
Science from Iasi, Romania.

        When I call gtk_adjustment_set_value() I receive Segmentation
fault, but not always. I attach a file with my function which cause
Segmentation fault and a gdb debuger stack.
        I would like to know what can produce this error.
void undo_undo (GtkWidget *w, gpointer data)
{
	UndoInfo *undo;
	
	if(debug)
		g_print("undo_undo\n");

	g_return_if_fail (doc!=NULL);

	if(doc->undo != NULL){
		undo = g_list_nth_data (doc->undo, 0);
		g_return_if_fail (undo != NULL);
	
		doc->redo = g_list_prepend (doc->redo, undo);
		doc->undo = g_list_remove (doc->undo, undo);
		
		if(doc->undo == NULL){
			undo_sensitive = FALSE;
			gtk_widget_set_sensitive(undo_button, undo_sensitive);
		}
		if(!redo_sensitive){
			redo_sensitive = !redo_sensitive;
			gtk_widget_set_sensitive(redo_button, redo_sensitive);
		}
		g_return_if_fail (undo->start_pos >= 0);
	
		switch (undo->action)
		{
		case UNDO_ACTION_DELETE:
			gtk_text_freeze(GTK_TEXT(file_text));
			gtk_text_set_point(GTK_TEXT(file_text), undo->start_pos);
			gtk_text_insert(GTK_TEXT(file_text), NULL, NULL, NULL,
	              		       undo->text, undo->end_pos-undo->start_pos);
		/*where undo->win_pos = GTK_TEXT(file_text)->vadj->value;*/
			gtk_adjustment_set_value(GTK_TEXT(file_text)->vadj, undo->win_pos);
			gtk_text_thaw(GTK_TEXT(file_text));
			break;
		case UNDO_ACTION_INSERT:
			gtk_text_freeze(GTK_TEXT(file_text));
			gtk_text_set_point(GTK_TEXT(file_text), undo->start_pos);
			gtk_text_forward_delete(GTK_TEXT(file_text),undo->end_pos-undo->start_pos);
			gtk_adjustment_set_value(GTK_TEXT(file_text)->vadj, undo->win_pos);
			gtk_text_thaw(GTK_TEXT(file_text));
			break;
		default:
			g_warning (" Undo unknown action.\n");
		};
	}
};

#0  0x400eb870 in advance_mark_n () from /usr/lib/libgtk-1.2.so.0
#1  0x400ee7e9 in draw_line () from /usr/lib/libgtk-1.2.so.0
#2  0x400eeef6 in expose_text () from /usr/lib/libgtk-1.2.so.0
#3  0x400ed799 in scroll_down () from /usr/lib/libgtk-1.2.so.0
#4  0x400e9bee in gtk_text_adjustment () from /usr/lib/libgtk-1.2.so.0
#5  0x400a7efd in gtk_marshal_NONE__NONE () from /usr/lib/libgtk-1.2.so.0
#6  0x400d55fd in gtk_handlers_run () from /usr/lib/libgtk-1.2.so.0
#7  0x400d4a42 in gtk_signal_real_emit () from /usr/lib/libgtk-1.2.so.0
#8  0x400d2b95 in gtk_signal_emit () from /usr/lib/libgtk-1.2.so.0
#9  0x4003f798 in gtk_adjustment_value_changed () from /usr/lib/libgtk-1.2.so.0
#10 0x4003f61c in gtk_adjustment_set_value () from /usr/lib/libgtk-1.2.so.0
#11 0x804baf6 in undo_undo ()

 


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