Mercurial > geeqie.yaz
diff src/filedata.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 | 4eed0789a828 |
children | b8e2690c440a |
line wrap: on
line diff
--- a/src/filedata.c Mon Apr 06 21:52:49 2009 +0000 +++ b/src/filedata.c Mon Apr 06 22:13:54 2009 +0000 @@ -2398,7 +2398,7 @@ } static GHashTable *file_data_monitor_pool = NULL; -static gint realtime_monitor_id = -1; +static guint realtime_monitor_id = 0; /* event source id */ static void realtime_monitor_check_cb(gpointer key, gpointer value, gpointer data) { @@ -2432,7 +2432,7 @@ count++; g_hash_table_insert(file_data_monitor_pool, fd, GINT_TO_POINTER(count)); - if (realtime_monitor_id == -1) + if (!realtime_monitor_id) { realtime_monitor_id = g_timeout_add(5000, realtime_monitor_cb, NULL); } @@ -2464,7 +2464,7 @@ if (g_hash_table_size(file_data_monitor_pool) == 0) { g_source_remove(realtime_monitor_id); - realtime_monitor_id = -1; + realtime_monitor_id = 0; return FALSE; }