diff src/thumb.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 68b73d524ca3
children c776b1310ca6
line wrap: on
line diff
--- a/src/thumb.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/thumb.c	Mon Apr 06 22:13:54 2009 +0000
@@ -250,7 +250,7 @@
 {
 	ThumbLoader *tl = data;
 
-	tl->idle_done_id = -1;
+	tl->idle_done_id = 0;
 
 	if (tl->func_done) tl->func_done(tl, tl->data);
 
@@ -259,7 +259,7 @@
 
 static void thumb_loader_delay_done(ThumbLoader *tl)
 {
-	if (tl->idle_done_id == -1) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
+	if (!tl->idle_done_id) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
 }
 
 static void thumb_loader_setup(ThumbLoader *tl, const gchar *path)
@@ -477,7 +477,6 @@
 	tl->percent_done = 0.0;
 	tl->max_w = width;
 	tl->max_h = height;
-	tl->idle_done_id = -1;
 
 	return tl;
 }
@@ -495,7 +494,7 @@
 	image_loader_free(tl->il);
 	file_data_unref(tl->fd);
 
-	if (tl->idle_done_id != -1) g_source_remove(tl->idle_done_id);
+	if (tl->idle_done_id) g_source_remove(tl->idle_done_id);
 
 	g_free(tl);
 }