|
|
c35f0a |
From fd5f67d2e3459168f9cf83648d5f7f91eccca61e Mon Sep 17 00:00:00 2001
|
|
|
c35f0a |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
c35f0a |
Date: Thu, 14 Jun 2018 17:43:27 +0200
|
|
|
c35f0a |
Subject: [PATCH] idle-monitor: NULL check cached InhibitedActions property
|
|
|
c35f0a |
variant
|
|
|
c35f0a |
|
|
|
c35f0a |
We might not have a cached "InhibitedActions" property available for us,
|
|
|
c35f0a |
so do as elsewhere in this file and NULL check before processing it.
|
|
|
c35f0a |
|
|
|
c35f0a |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/130
|
|
|
c35f0a |
---
|
|
|
c35f0a |
src/backends/meta-idle-monitor.c | 7 +++++--
|
|
|
c35f0a |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
c35f0a |
|
|
|
c35f0a |
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
|
|
|
c35f0a |
index c6e814468..6ce024001 100644
|
|
|
c35f0a |
--- a/src/backends/meta-idle-monitor.c
|
|
|
c35f0a |
+++ b/src/backends/meta-idle-monitor.c
|
|
|
c35f0a |
@@ -235,62 +235,65 @@ meta_idle_monitor_inhibited_actions_changed (GDBusProxy *session,
|
|
|
c35f0a |
}
|
|
|
c35f0a |
}
|
|
|
c35f0a |
|
|
|
c35f0a |
static void
|
|
|
c35f0a |
meta_idle_monitor_init (MetaIdleMonitor *monitor)
|
|
|
c35f0a |
{
|
|
|
c35f0a |
GVariant *v;
|
|
|
c35f0a |
|
|
|
c35f0a |
monitor->watches = g_hash_table_new_full (NULL, NULL, NULL, free_watch);
|
|
|
c35f0a |
monitor->last_event_time = g_get_monotonic_time ();
|
|
|
c35f0a |
|
|
|
c35f0a |
/* Monitor inhibitors */
|
|
|
c35f0a |
monitor->session_proxy =
|
|
|
c35f0a |
g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
|
|
|
c35f0a |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
|
|
|
c35f0a |
NULL,
|
|
|
c35f0a |
"org.gnome.SessionManager",
|
|
|
c35f0a |
"/org/gnome/SessionManager",
|
|
|
c35f0a |
"org.gnome.SessionManager",
|
|
|
c35f0a |
NULL,
|
|
|
c35f0a |
NULL);
|
|
|
c35f0a |
if (!monitor->session_proxy)
|
|
|
c35f0a |
return;
|
|
|
c35f0a |
|
|
|
c35f0a |
g_signal_connect (monitor->session_proxy, "g-properties-changed",
|
|
|
c35f0a |
G_CALLBACK (meta_idle_monitor_inhibited_actions_changed),
|
|
|
c35f0a |
monitor);
|
|
|
c35f0a |
|
|
|
c35f0a |
v = g_dbus_proxy_get_cached_property (monitor->session_proxy,
|
|
|
c35f0a |
"InhibitedActions");
|
|
|
c35f0a |
- monitor->inhibited = g_variant_get_uint32 (v) & GSM_INHIBITOR_FLAG_IDLE;
|
|
|
c35f0a |
- g_variant_unref (v);
|
|
|
c35f0a |
+ if (v)
|
|
|
c35f0a |
+ {
|
|
|
c35f0a |
+ monitor->inhibited = g_variant_get_uint32 (v) & GSM_INHIBITOR_FLAG_IDLE;
|
|
|
c35f0a |
+ g_variant_unref (v);
|
|
|
c35f0a |
+ }
|
|
|
c35f0a |
}
|
|
|
c35f0a |
|
|
|
c35f0a |
/**
|
|
|
c35f0a |
* meta_idle_monitor_get_core:
|
|
|
c35f0a |
*
|
|
|
c35f0a |
* Returns: (transfer none): the #MetaIdleMonitor that tracks the server-global
|
|
|
c35f0a |
* idletime for all devices. To track device-specific idletime,
|
|
|
c35f0a |
* use meta_idle_monitor_get_for_device().
|
|
|
c35f0a |
*/
|
|
|
c35f0a |
MetaIdleMonitor *
|
|
|
c35f0a |
meta_idle_monitor_get_core (void)
|
|
|
c35f0a |
{
|
|
|
c35f0a |
MetaBackend *backend = meta_get_backend ();
|
|
|
c35f0a |
return meta_backend_get_idle_monitor (backend, 0);
|
|
|
c35f0a |
}
|
|
|
c35f0a |
|
|
|
c35f0a |
/**
|
|
|
c35f0a |
* meta_idle_monitor_get_for_device:
|
|
|
c35f0a |
* @device_id: the device to get the idle time for.
|
|
|
c35f0a |
*
|
|
|
c35f0a |
* Returns: (transfer none): a new #MetaIdleMonitor that tracks the
|
|
|
c35f0a |
* device-specific idletime for @device. To track server-global idletime
|
|
|
c35f0a |
* for all devices, use meta_idle_monitor_get_core().
|
|
|
c35f0a |
*/
|
|
|
c35f0a |
MetaIdleMonitor *
|
|
|
c35f0a |
meta_idle_monitor_get_for_device (int device_id)
|
|
|
c35f0a |
{
|
|
|
c35f0a |
MetaBackend *backend = meta_get_backend ();
|
|
|
c35f0a |
return meta_backend_get_idle_monitor (backend, device_id);
|
|
|
c35f0a |
}
|
|
|
c35f0a |
--
|
|
|
c35f0a |
2.28.0
|
|
|
c35f0a |
|