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.
This commit is contained in:
parent
4f757aeeb4
commit
0fd763bb25
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user