Mercurial > geeqie.yaz
diff src/bar_histogram.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 | 5f49f305a6b6 |
children | 7f91f906f9c2 |
line wrap: on
line diff
--- a/src/bar_histogram.c Mon Apr 06 21:52:49 2009 +0000 +++ b/src/bar_histogram.c Mon Apr 06 22:13:54 2009 +0000 @@ -43,7 +43,7 @@ GdkPixbuf *pixbuf; FileData *fd; gboolean need_update; - gint idle_id; + guint idle_id; /* event source id */ }; static gboolean bar_pane_histogram_update_cb(gpointer data); @@ -63,7 +63,10 @@ FIXME: this does not work for fullscreen*/ if (GTK_WIDGET_DRAWABLE(phd->drawing_area)) { - if (phd->idle_id == -1) phd->idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, bar_pane_histogram_update_cb, phd, NULL); + if (!phd->idle_id) + { + phd->idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, bar_pane_histogram_update_cb, phd, NULL); + } } else { @@ -76,7 +79,7 @@ const HistMap *histmap; PaneHistogramData *phd = data; - phd->idle_id = -1; + phd->idle_id = 0; phd->need_update = FALSE; gtk_widget_queue_draw_area(GTK_WIDGET(phd->drawing_area), 0, 0, phd->histogram_width, phd->histogram_height); @@ -182,7 +185,7 @@ { PaneHistogramData *phd = data; - g_source_remove(phd->idle_id); + if (phd->idle_id) g_source_remove(phd->idle_id); file_data_unregister_notify_func(bar_pane_histogram_notify_cb, phd); file_data_unref(phd->fd); @@ -346,7 +349,6 @@ phd->pane.type = PANE_HISTOGRAM; phd->pane.expanded = expanded; - phd->idle_id = -1; phd->histogram = histogram_new();