diff src/dupe.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 c9ed5a43c576
children 58a5d1e01e33
line wrap: on
line diff
--- a/src/dupe.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/dupe.c	Mon Apr 06 22:13:54 2009 +0000
@@ -1347,10 +1347,10 @@
 
 static void dupe_check_stop(DupeWindow *dw)
 {
-	if (dw->idle_id != -1 || dw->img_loader || dw->thumb_loader)
+	if (dw->idle_id || dw->img_loader || dw->thumb_loader)
 		{
 		g_source_remove(dw->idle_id);
-		dw->idle_id = -1;
+		dw->idle_id = 0;
 		dupe_window_update_progress(dw, NULL, 0.0, FALSE);
 		widget_set_cursor(dw->listview, -1);
 		}
@@ -1424,7 +1424,7 @@
 {
 	DupeWindow *dw = data;
 
-	if (dw->idle_id == -1) return FALSE;
+	if (!dw->idle_id) return FALSE;
 
 	if (!dw->setup_done)
 		{
@@ -1535,7 +1535,7 @@
 						dw->img_loader = NULL;
 						return TRUE;
 						}
-					dw->idle_id = -1;
+					dw->idle_id = 0;
 					return FALSE;
 					}
 
@@ -1559,7 +1559,7 @@
 			dupe_window_update_progress(dw, _("Sorting..."), 1.0, TRUE);
 			return TRUE;
 			}
-		dw->idle_id = -1;
+		dw->idle_id = 0;
 		dupe_window_update_progress(dw, NULL, 0.0, FALSE);
 
 		dupe_match_rank(dw);
@@ -1599,7 +1599,7 @@
 	dupe_window_update_count(dw, TRUE);
 	widget_set_cursor(dw->listview, GDK_WATCH);
 
-	if (dw->idle_id != -1) return;
+	if (dw->idle_id) return;
 
 	dw->idle_id = g_idle_add(dupe_check_cb, dw);
 }
@@ -3116,14 +3116,7 @@
 
 	dw = g_new0(DupeWindow, 1);
 
-	dw->list = NULL;
-	dw->dupes = NULL;
 	dw->match_mask = match_mask;
-	dw->show_thumbs = FALSE;
-
-	dw->idle_id = -1;
-
-	dw->second_set = FALSE;
 
 	dw->window = window_new(GTK_WINDOW_TOPLEVEL, "dupe", NULL, NULL, _("Find duplicates"));