diff src/slideshow.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 a6f9ba6fd751
children 1a134b4dc88c
line wrap: on
line diff
--- a/src/slideshow.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/slideshow.c	Mon Apr 06 22:13:54 2009 +0000
@@ -297,7 +297,7 @@
 
 	if (!slideshow_step(ss, TRUE))
 		{
-		ss->timeout_id = -1;
+		ss->timeout_id = 0;
 		slideshow_free(ss);
 		return FALSE;
 		}
@@ -307,17 +307,17 @@
 
 static void slideshow_timer_stop(SlideShowData *ss)
 {
-	if (ss->timeout_id == -1) return;
+	if (!ss->timeout_id) return;
 
 	g_source_remove(ss->timeout_id);
-	ss->timeout_id = -1;
+	ss->timeout_id = 0;
 }
 
 static void slideshow_timer_reset(SlideShowData *ss)
 {
 	if (options->slideshow.delay < 1) options->slideshow.delay = 1;
 
-	if (ss->timeout_id != -1) g_source_remove(ss->timeout_id);
+	if (ss->timeout_id) g_source_remove(ss->timeout_id);
 	ss->timeout_id = g_timeout_add(options->slideshow.delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
 				       slideshow_loop_cb, ss);
 }
@@ -361,7 +361,6 @@
 	ss->filelist = filelist;
 	ss->cd = cd;
 	ss->layout = lw;
-	ss->timeout_id = -1;
 
 	if (ss->filelist)
 		{