diff src/utilops.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 67b40740122e
children fffb62c7ba1e
line wrap: on
line diff
--- a/src/utilops.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/utilops.c	Mon Apr 06 22:13:54 2009 +0000
@@ -283,9 +283,8 @@
 	GenericDialog *gd;
 	FileDialog *fdlg;
 	
-	gint update_idle_id;
-
-	gint perform_idle_id;
+	guint update_idle_id; /* event source id */
+	guint perform_idle_id; /* event source id */
 
 	gboolean with_sidecars; /* operate on grouped or single files; TRUE = use file_data_sc_, FALSE = use file_data_ functions */
 	
@@ -344,8 +343,6 @@
 	
 	ud->type = type;
 	ud->phase = UTILITY_PHASE_START;
-	ud->update_idle_id = -1;
-	ud->perform_idle_id = -1;
 	
 	return ud;
 }
@@ -354,8 +351,8 @@
 {
 	if (!ud) return;
 
-	if (ud->update_idle_id != -1) g_source_remove(ud->update_idle_id);
-	if (ud->perform_idle_id != -1) g_source_remove(ud->perform_idle_id);
+	if (ud->update_idle_id) g_source_remove(ud->update_idle_id);
+	if (ud->perform_idle_id) g_source_remove(ud->perform_idle_id);
 
 	file_data_unref(ud->dir_fd);
 	filelist_free(ud->content_list);
@@ -592,7 +589,7 @@
 {
 	UtilityData *ud = data;
 
-	if (ud->perform_idle_id == -1) 
+	if (!ud->perform_idle_id) 
 		{
 		/* this function was called directly
 		   just setup idle callback and wait until we are called again
@@ -1226,7 +1223,7 @@
 
 	file_util_rename_preview_update(ud);
 
-	ud->update_idle_id = -1;
+	ud->update_idle_id = 0;
 	return FALSE;
 }
 
@@ -1235,7 +1232,7 @@
 {
 	UtilityData *ud = data;
 
-	if (ud->update_idle_id != -1) return;
+	if (ud->update_idle_id) return;
 
 	ud->update_idle_id = g_idle_add(file_util_rename_idle_cb, ud);
 }