[mutter/wayland] MetaIdleMonitor: protect the monitor instance while calling destroy notify



commit 348f3007d9ba38b97df1402ce2931f782a264ad2
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Fri Sep 20 14:25:34 2013 +0200

    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

 src/core/meta-idle-monitor.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/core/meta-idle-monitor.c b/src/core/meta-idle-monitor.c
index 3c0d31e..24e7894 100644
--- a/src/core/meta-idle-monitor.c
+++ b/src/core/meta-idle-monitor.c
@@ -293,6 +293,7 @@ idle_monitor_watch_free (MetaIdleMonitorWatch *watch)
     return;
 
   monitor = watch->monitor;
+  g_object_ref (monitor);
 
   if (watch->idle_source_id)
     {
@@ -313,6 +314,7 @@ idle_monitor_watch_free (MetaIdleMonitorWatch *watch)
   if (watch->timeout_source != NULL)
     g_source_destroy (watch->timeout_source);
 
+  g_object_unref (monitor);
   g_slice_free (MetaIdleMonitorWatch, watch);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]