Mercurial > geeqie
diff src/image-load.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 | 0a1266bde95b |
children | 6026466313b2 |
line wrap: on
line diff
--- a/src/image-load.c Mon Apr 06 21:52:49 2009 +0000 +++ b/src/image-load.c Mon Apr 06 22:13:54 2009 +0000 @@ -72,7 +72,7 @@ ImageLoader *il = (ImageLoader *)instance; il->pixbuf = NULL; - il->idle_id = -1; + il->idle_id = 0; il->idle_priority = G_PRIORITY_DEFAULT_IDLE; il->done = FALSE; il->loader = NULL; @@ -80,7 +80,7 @@ il->bytes_read = 0; il->bytes_total = 0; - il->idle_done_id = -1; + il->idle_done_id = 0; il->idle_read_loop_count = IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT; il->read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT; @@ -162,7 +162,11 @@ DEBUG_1("freeing image loader %p bytes_read=%d", il, il->bytes_read); - if (il->idle_done_id != -1) g_source_remove(il->idle_done_id); + if (il->idle_done_id) + { + g_source_remove(il->idle_done_id); + il->idle_done_id = 0; + } while (g_source_remove_by_user_data(il)) { @@ -683,10 +687,10 @@ { if (!il) return; - if (il->idle_id != -1) + if (il->idle_id) { g_source_remove(il->idle_id); - il->idle_id = -1; + il->idle_id = 0; } if (il->thread) @@ -743,7 +747,7 @@ gboolean ret = FALSE; ImageLoader *il = data; - if (il->idle_id != -1) + if (il->idle_id) { ret = image_loader_continue(il); }