[easytag] Clear the statusbar timeout ID when it expires



commit 712bbffee0243317baf0644dd84c6fca8789b6d2
Author: David King <amigadave amigadave com>
Date:   Thu Feb 6 23:38:43 2014 +0000

    Clear the statusbar timeout ID when it expires
    
    Avoids a critical warning that the source had already been removed.

 src/bar.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/bar.c b/src/bar.c
index 1fe4f5d..f11c266 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -539,12 +539,19 @@ Statusbar_Stop_Timer (void)
 }
 
 static void
+et_statusbar_reset_timer (void)
+{
+    StatusbarTimerId = 0;
+}
+
+static void
 Statusbar_Start_Timer (void)
 {
     Statusbar_Remove_Timer ();
-    StatusbarTimerId = g_timeout_add_seconds (4,
-                                              (GSourceFunc)Statusbar_Stop_Timer,
-                                              NULL);
+    StatusbarTimerId = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, 4,
+                                                   (GSourceFunc)Statusbar_Stop_Timer,
+                                                   NULL,
+                                                   (GDestroyNotify)et_statusbar_reset_timer);
     g_source_set_name_by_id (StatusbarTimerId, "Statusbar stop timer");
 }
 
@@ -555,7 +562,7 @@ Statusbar_Remove_Timer (void)
     {
         Statusbar_Stop_Timer ();
         g_source_remove(StatusbarTimerId);
-        StatusbarTimerId = 0;
+        et_statusbar_reset_timer ();
     }
 }
 


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