diff src/ui_tree_edit.c @ 1523:24a12aa0cb54

Fix up event source ids type: gint -> guint. Functions like g_timeout_add() or g_idle_add() return a guint greater than 0, but in most places it was wrongly stored as int and initialized to -1. This broke assertions matching in g_source_remove() for example since id was always greater than 0 even when timer was not set (-1 was casted to the biggest guint).
author zas_
date Mon, 06 Apr 2009 22:13:54 +0000
parents 89dedc61b1bd
children 2349fa90226d
line wrap: on
line diff
--- a/src/ui_tree_edit.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/ui_tree_edit.c	Mon Apr 06 22:13:54 2009 +0000
@@ -524,7 +524,7 @@
 typedef struct _AutoScrollData AutoScrollData;
 struct _AutoScrollData
 {
-	gint timer_id;
+	guint timer_id; /* event source id */
 	gint region_size;
 	GtkWidget *widget;
 	GtkAdjustment *adj;
@@ -542,7 +542,7 @@
 	if (!sd) return;
 	g_object_set_data(G_OBJECT(widget), "autoscroll", NULL);
 
-	if (sd->timer_id != -1) g_source_remove(sd->timer_id);
+	if (sd->timer_id) g_source_remove(sd->timer_id);
 	g_free(sd);
 }
 
@@ -565,7 +565,7 @@
 
 	if (x < 0 || x >= w || y < 0 || y >= h)
 		{
-		sd->timer_id = -1;
+		sd->timer_id = 0;
 		widget_auto_scroll_stop(sd->widget);
 		return FALSE;
 		}
@@ -596,7 +596,7 @@
 			/* only notify when scrolling is needed */
 			if (sd->notify_func && !sd->notify_func(sd->widget, x, y, sd->notify_data))
 				{
-				sd->timer_id = -1;
+				sd->timer_id = 0;
 				widget_auto_scroll_stop(sd->widget);
 				return FALSE;
 				}