Mercurial > geeqie
comparison 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 | c03a8e19a43a |
comparison
equal
deleted
inserted
replaced
1522:d7206703d90f | 1523:24a12aa0cb54 |
---|---|
2396 work = work->next; | 2396 work = work->next; |
2397 } | 2397 } |
2398 } | 2398 } |
2399 | 2399 |
2400 static GHashTable *file_data_monitor_pool = NULL; | 2400 static GHashTable *file_data_monitor_pool = NULL; |
2401 static gint realtime_monitor_id = -1; | 2401 static guint realtime_monitor_id = 0; /* event source id */ |
2402 | 2402 |
2403 static void realtime_monitor_check_cb(gpointer key, gpointer value, gpointer data) | 2403 static void realtime_monitor_check_cb(gpointer key, gpointer value, gpointer data) |
2404 { | 2404 { |
2405 FileData *fd = key; | 2405 FileData *fd = key; |
2406 | 2406 |
2430 DEBUG_1("Register realtime %d %s", count, fd->path); | 2430 DEBUG_1("Register realtime %d %s", count, fd->path); |
2431 | 2431 |
2432 count++; | 2432 count++; |
2433 g_hash_table_insert(file_data_monitor_pool, fd, GINT_TO_POINTER(count)); | 2433 g_hash_table_insert(file_data_monitor_pool, fd, GINT_TO_POINTER(count)); |
2434 | 2434 |
2435 if (realtime_monitor_id == -1) | 2435 if (!realtime_monitor_id) |
2436 { | 2436 { |
2437 realtime_monitor_id = g_timeout_add(5000, realtime_monitor_cb, NULL); | 2437 realtime_monitor_id = g_timeout_add(5000, realtime_monitor_cb, NULL); |
2438 } | 2438 } |
2439 | 2439 |
2440 return TRUE; | 2440 return TRUE; |
2462 file_data_unref(fd); | 2462 file_data_unref(fd); |
2463 | 2463 |
2464 if (g_hash_table_size(file_data_monitor_pool) == 0) | 2464 if (g_hash_table_size(file_data_monitor_pool) == 0) |
2465 { | 2465 { |
2466 g_source_remove(realtime_monitor_id); | 2466 g_source_remove(realtime_monitor_id); |
2467 realtime_monitor_id = -1; | 2467 realtime_monitor_id = 0; |
2468 return FALSE; | 2468 return FALSE; |
2469 } | 2469 } |
2470 | 2470 |
2471 return TRUE; | 2471 return TRUE; |
2472 } | 2472 } |