diff src/view_file_list.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 d352a44545a6
children 4df9f4712d1a
line wrap: on
line diff
--- a/src/view_file_list.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/view_file_list.c	Mon Apr 06 22:13:54 2009 +0000
@@ -718,7 +718,7 @@
 
 	if (!vf->layout)
 		{
-		VFLIST(vf)->select_idle_id = -1;
+		VFLIST(vf)->select_idle_id = 0;
 		return FALSE;
 		}
 
@@ -730,14 +730,17 @@
 		VFLIST(vf)->select_fd = NULL;
 		}
 
-	VFLIST(vf)->select_idle_id = -1;
+	VFLIST(vf)->select_idle_id = 0;
 	return FALSE;
 }
 
 static void vflist_select_idle_cancel(ViewFile *vf)
 {
-	if (VFLIST(vf)->select_idle_id != -1) g_source_remove(VFLIST(vf)->select_idle_id);
-	VFLIST(vf)->select_idle_id = -1;
+	if (VFLIST(vf)->select_idle_id)
+		{
+		g_source_remove(VFLIST(vf)->select_idle_id);
+		VFLIST(vf)->select_idle_id = 0;
+		}
 }
 
 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
@@ -757,7 +760,7 @@
 		}
 
 	if (vf->layout &&
-	    VFLIST(vf)->select_idle_id == -1)
+	    !VFLIST(vf)->select_idle_id)
 		{
 		VFLIST(vf)->select_idle_id = g_idle_add(vflist_select_idle_cb, vf);
 		}
@@ -1973,8 +1976,6 @@
 
 	vf->info = g_new0(ViewFileInfoList, 1);
 	
-	VFLIST(vf)->select_idle_id = -1;
-
 	flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
 	flist_types[FILE_COLUMN_VERSION] = G_TYPE_INT;
 	flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;