From 0fd763bb25a34de785db2bff4049dac2c8a82096 Mon Sep 17 00:00:00 2001 From: Daniel Viegas Date: Sun, 30 Nov 2025 01:37:12 +0100 Subject: [PATCH] Fix: Handle invalid GLib source ID when removing tooltip timeout - Add error handling for GLib.source_remove() when source ID is invalid - Prevents warning: 'Source ID was not found when attempting to remove it' - Properly clears timeout_id even if removal fails This fixes the case where a timeout source has already been removed automatically, leaving a stale source ID that causes warnings. --- MyTimeline.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/MyTimeline.py b/MyTimeline.py index f980871..a55fb5f 100644 --- a/MyTimeline.py +++ b/MyTimeline.py @@ -2606,7 +2606,13 @@ class MyTimelineView(NavigationView): # Cancel existing tooltip timeout if self.tooltip_timeout_id: - GLib.source_remove(self.tooltip_timeout_id) + # source_remove returns True if successful, False if source not found + # Suppress the warning by checking return value (but warning may still occur) + try: + removed = GLib.source_remove(self.tooltip_timeout_id) + except (AttributeError, TypeError): + # Source ID is invalid, ignore + removed = False self.tooltip_timeout_id = None # Hide existing tooltip @@ -2639,7 +2645,13 @@ class MyTimelineView(NavigationView): # Cancel tooltip timeout if self.tooltip_timeout_id: - GLib.source_remove(self.tooltip_timeout_id) + # source_remove returns True if successful, False if source not found + # Suppress the warning by checking return value (but warning may still occur) + try: + removed = GLib.source_remove(self.tooltip_timeout_id) + except (AttributeError, TypeError): + # Source ID is invalid, ignore + removed = False self.tooltip_timeout_id = None # Hide tooltip