diff src/print.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 f879e7d94c6d
children 25bed5b179be
line wrap: on
line diff
--- a/src/print.c	Mon Apr 06 21:52:49 2009 +0000
+++ b/src/print.c	Mon Apr 06 22:13:54 2009 +0000
@@ -232,7 +232,7 @@
 	gdouble layout_width;
 	gdouble layout_height;
 
-	gint layout_idle_id;
+	guint layout_idle_id; /* event source id */
 
 	gdouble image_scale;
 
@@ -570,10 +570,10 @@
 
 static void print_window_layout_render_stop(PrintWindow *pw)
 {
-	if (pw->layout_idle_id != -1)
+	if (pw->layout_idle_id)
 		{
 		g_source_remove(pw->layout_idle_id);
-		pw->layout_idle_id = -1;
+		pw->layout_idle_id = 0;
 		}
 }
 
@@ -584,7 +584,7 @@
 	print_job_close(pw, FALSE);
 	print_job_start(pw, RENDER_FORMAT_PREVIEW, 0);
 
-	pw->layout_idle_id = -1;
+	pw->layout_idle_id = 0;
 	return FALSE;
 }
 
@@ -598,7 +598,7 @@
 
 	print_window_layout_status(pw);
 
-	if (pw->layout_idle_id == -1)
+	if (!pw->layout_idle_id)
 		{
 		pw->layout_idle_id = g_idle_add(print_window_layout_render_idle, pw);
 		}
@@ -750,7 +750,7 @@
 	vbox = pref_box_new(box, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
 	group = pref_frame_new(vbox, TRUE, _("Preview"), GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
 
-	pw->layout_idle_id = -1;
+	pw->layout_idle_id = 0;
 
 	pw->layout_image = image_new(FALSE);
 	gtk_widget_set_size_request(pw->layout_image->widget, PRINT_DLG_PREVIEW_WIDTH, PRINT_DLG_PREVIEW_HEIGHT);