[gnome-video-arcade] Do not treat start() as a GSourceFunc.



commit 32ac5b578298f289653aae786cae8cdf18ac1238
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Jan 15 22:25:24 2012 -0500

    Do not treat start() as a GSourceFunc.
    
    Idiotic mistake in main() where we schedule start() directly as a main
    loop callback.  Problem is main loop callbacks must return a boolean,
    and start(), which is only meant to run once, has a void return type.
    So it's a coin toss whether start() will be run over and over again.

 src/main.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 533b3c8..50b5022 100644
--- a/src/main.c
+++ b/src/main.c
@@ -290,6 +290,15 @@ start (void)
         setup_file_monitors ();
 }
 
+static gboolean
+idle_start (gpointer unused)
+{
+        start ();
+
+        /* Do not reschedule this callback. */
+        return FALSE;
+}
+
 gint
 main (gint argc, gchar **argv)
 {
@@ -416,7 +425,7 @@ main (gint argc, gchar **argv)
         gva_nplayers_init (&error);
         gva_error_handle (&error);
 
-        g_idle_add ((GSourceFunc) start, NULL);
+        g_idle_add (idle_start, NULL);
 
         gtk_main ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]