[gnome-applets] gweather: avoid criticals



commit 9c3ecfd554835a865c237ed2ab2eaf6fe0948f94
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Mar 12 23:35:32 2018 +0200

    gweather: avoid criticals
    
    Make sure that we don't try to remove GSource that is already removed.

 gweather/src/gweather-applet.c |   22 ++++++++++++++++------
 gweather/src/gweather-applet.h |    8 ++++----
 2 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/gweather/src/gweather-applet.c b/gweather/src/gweather-applet.c
index 0f4f7e6..44ebc3b 100644
--- a/gweather/src/gweather-applet.c
+++ b/gweather/src/gweather-applet.c
@@ -410,12 +410,16 @@ void gweather_applet_create (GWeatherApplet *gw_applet)
                       G_CALLBACK (network_changed), gw_applet);
 }
 
-gint timeout_cb (gpointer data)
+gboolean
+timeout_cb (gpointer data)
 {
     GWeatherApplet *gw_applet = (GWeatherApplet *)data;
-       
+
+    gw_applet->timeout_tag = 0;
     gweather_update(gw_applet);
-    return 0;  /* Do not repeat timeout (will be re-set by gweather_update) */
+
+    /* Do not repeat timeout (will be re-set by gweather_update) */
+    return G_SOURCE_REMOVE;
 }
 
 static void
@@ -522,11 +526,17 @@ update_finish (GWeatherInfo *info, gpointer data)
     }
 }
 
-gint suncalc_timeout_cb (gpointer data)
+gboolean
+suncalc_timeout_cb (gpointer data)
 {
-    GWeatherInfo *info = ((GWeatherApplet *)data)->gweather_info;
+    GWeatherApplet *gw_applet = (GWeatherApplet *)data;
+    GWeatherInfo *info = gw_applet->gweather_info;
+
+    gw_applet->suncalc_timeout_tag = 0;
     update_finish(info, data);
-    return 0;  /* Do not repeat timeout (will be re-set by update_finish) */
+
+    /* Do not repeat timeout (will be re-set by update_finish) */
+    return G_SOURCE_REMOVE;
 }
 
 void gweather_update (GWeatherApplet *gw_applet)
diff --git a/gweather/src/gweather-applet.h b/gweather/src/gweather-applet.h
index a895c43..5d44f51 100644
--- a/gweather/src/gweather-applet.h
+++ b/gweather/src/gweather-applet.h
@@ -24,10 +24,10 @@
 
 G_BEGIN_DECLS
 
-extern void gweather_applet_create(GWeatherApplet *gw_applet);
-extern gint timeout_cb (gpointer data);
-extern gint suncalc_timeout_cb (gpointer data);
-extern void gweather_update (GWeatherApplet *applet);
+void gweather_applet_create(GWeatherApplet *gw_applet);
+gboolean timeout_cb (gpointer data);
+gboolean suncalc_timeout_cb (gpointer data);
+void gweather_update (GWeatherApplet *applet);
 
 G_END_DECLS
 


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