← Back to team overview

geda-developers team mailing list archive

A pcb patch

 

Hi,

attached is a small patch for pcb that fixes those annoying
warnings of the form

  (pcb:7135): GLib-CRITICAL **: Source ID 258 was not found when
  attempting to remove it

that I've been seeing recently.

-- 
Ivan Stankovic, pokemon@xxxxxxxxxxxxxx

"Protect your digital freedom and privacy, eliminate DRM, 
learn more at http://www.defectivebydesign.org/what_is_drm";
>From f82a5e637478c86cba572cc133a870157e362568 Mon Sep 17 00:00:00 2001
From: Ivan Stankovic <pokemon@xxxxxxxxxxxxxx>
Date: Sat, 26 Apr 2014 20:59:05 +0200
Subject: [PATCH 1/1] hid/gtk: reset tooltip_update_timeout_id properly

check_object_tooltips may run before cancel_tooltip_update,
causing its GSource to be removed, but leaving the old
timeout id.  This results in warnings such as

  (pcb:7135): GLib-CRITICAL **: Source ID 258 was not found when
  attempting to remove it

So we simply reset the id to zero before returning from
check_object_tooltips.
---
 src/hid/gtk/gui-output-events.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index cc612c4..037ca57 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -459,6 +459,8 @@ describe_location (Coord X, Coord Y)
 }
 
 
+static int tooltip_update_timeout_id = 0;
+
 static gboolean check_object_tooltips (GHidPort *out)
 {
   char *description;
@@ -466,23 +468,23 @@ static gboolean check_object_tooltips (GHidPort *out)
   /* check if there are any pins or pads at that position */
   description = describe_location (out->crosshair_x, out->crosshair_y);
 
-  if (description == NULL)
-    return FALSE;
-
-  gtk_widget_set_tooltip_text (out->drawing_area, description);
-  g_free (description);
+  if (description) {
+    gtk_widget_set_tooltip_text (out->drawing_area, description);
+    g_free (description);
+  }
 
+  tooltip_update_timeout_id = 0;
   return FALSE;
 }
 
-static int tooltip_update_timeout_id = 0;
 
 static void
 cancel_tooltip_update ()
 {
-  if (tooltip_update_timeout_id)
+  if (tooltip_update_timeout_id) {
     g_source_remove (tooltip_update_timeout_id);
-  tooltip_update_timeout_id = 0;
+    tooltip_update_timeout_id = 0;
+  }
 }
 
 /* FIXME: If the GHidPort is ever destroyed, we must call
-- 
1.9.2