summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagn@redhat.com>2013-09-20 14:25:34 +0200
committerGiovanni Campagna <gcampagn@redhat.com>2013-09-26 18:55:44 +0200
commit85c2bc29e618ca805b26a645da70c70426579cda (patch)
treec8406f43d1b3d4251f157cb16b710f8ef9706019
parent4eeeb1557a3a0caff6ef1debd92aeb541ae1b556 (diff)
MetaIdleMonitor: protect the monitor instance while calling destroy notify
The destroy notify for a DBus watch holds a reference to the IdleMonitor, but the IdleMonitorWatch object doesn't (it knows all watches will be destroyed before the monitor is, so it doesn't need one). This means that the DBus watch reference can be the only one keeping the IdleMonitor alive (expecially true for device idle monitors, which are only used by g-s-d/cursor), and that means that calling the destroy notify freezes the monitor (and the next X calls access garbage). https://bugzilla.gnome.org/show_bug.cgi?id=708420
-rw-r--r--src/core/meta-idle-monitor.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/meta-idle-monitor.c b/src/core/meta-idle-monitor.c
index d351e65a..a516d990 100644
--- a/src/core/meta-idle-monitor.c
+++ b/src/core/meta-idle-monitor.c
@@ -287,6 +287,7 @@ idle_monitor_watch_free (MetaIdleMonitorWatch *watch)
return;
monitor = watch->monitor;
+ g_object_ref (monitor);
if (watch->idle_source_id)
{
@@ -304,6 +305,7 @@ idle_monitor_watch_free (MetaIdleMonitorWatch *watch)
g_hash_table_remove (monitor->alarms, (gpointer) watch->xalarm);
}
+ g_object_unref (monitor);
g_slice_free (MetaIdleMonitorWatch, watch);
}