diff src/metadata.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 e70bbc97acc5
children 286ed7c6cae6
line wrap: on
line diff
--- a/src/metadata.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/metadata.c	Mon Apr 06 22:13:54 2009 +0000
@@ -47,7 +47,7 @@
  */
 
 static GList *metadata_write_queue = NULL;
-static gint metadata_write_idle_id = -1;
+static guint metadata_write_idle_id = 0; /* event source id */
 
 static void metadata_write_queue_add(FileData *fd)
 {
@@ -59,10 +59,10 @@
 		layout_status_update_write_all();
 		}
 
-	if (metadata_write_idle_id != -1) 
+	if (metadata_write_idle_id) 
 		{
 		g_source_remove(metadata_write_idle_id);
-		metadata_write_idle_id = -1;
+		metadata_write_idle_id = 0;
 		}
 	
 	if (options->metadata.confirm_after_timeout)
@@ -130,7 +130,7 @@
 static gboolean metadata_write_queue_idle_cb(gpointer data)
 {
 	metadata_write_queue_confirm(NULL, NULL);
-	metadata_write_idle_id = -1;
+	metadata_write_idle_id = 0;
 	return FALSE;
 }