summaryrefslogtreecommitdiff
path: root/src/backends/meta-idle-monitor.c
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@posteo.de>2019-11-22 00:25:30 +0100
committerRobert Mader <robert.mader@posteo.de>2019-11-22 01:27:40 +0100
commit8e172aeecb0540acb0638c2a7c47e8c537085050 (patch)
treef0f66ea6a4511047b5f4d1193853afb817eced4b /src/backends/meta-idle-monitor.c
parent51f68f1054c7d5a7d0ef2fad773954271d2a1414 (diff)
downloadmutter-8e172aeecb0540acb0638c2a7c47e8c537085050.tar.gz
cleanup: Use g_clear_handle_id() for g_source_remove()
It makes sure we do not forget to zero the id and lets us avoid zero checks before. We use it for all new code, lets clean up the existing code base. https://gitlab.gnome.org/GNOME/mutter/merge_requests/947
Diffstat (limited to 'src/backends/meta-idle-monitor.c')
-rw-r--r--src/backends/meta-idle-monitor.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
index 2ff1602e7..4304db142 100644
--- a/src/backends/meta-idle-monitor.c
+++ b/src/backends/meta-idle-monitor.c
@@ -64,11 +64,7 @@ meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch)
monitor = watch->monitor;
g_object_ref (monitor);
- if (watch->idle_source_id)
- {
- g_source_remove (watch->idle_source_id);
- watch->idle_source_id = 0;
- }
+ g_clear_handle_id (&watch->idle_source_id, g_source_remove);
id = watch->id;
is_user_active_watch = (watch->timeout_msec == 0);
@@ -161,11 +157,7 @@ free_watch (gpointer data)
g_object_ref (monitor);
- if (watch->idle_source_id)
- {
- g_source_remove (watch->idle_source_id);
- watch->idle_source_id = 0;
- }
+ g_clear_handle_id (&watch->idle_source_id, g_source_remove);
if (watch->notify != NULL)
watch->notify (watch->user_data);