[gnome-desktop] monitor: Be defensive against callbacks unreffing monitor in callback



commit a87ead14dfefcb0769dcf636eb2106c51b69d08c
Author: Colin Walters <walters verbum org>
Date:   Mon Mar 25 19:57:46 2013 -0400

    monitor: Be defensive against callbacks unreffing monitor in callback
    
    gnome-settings-daemon's cursor plugin does this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696522

 libgnome-desktop/gnome-idle-monitor.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-idle-monitor.c b/libgnome-desktop/gnome-idle-monitor.c
index ac9d354..bc21736 100644
--- a/libgnome-desktop/gnome-idle-monitor.c
+++ b/libgnome-desktop/gnome-idle-monitor.c
@@ -143,6 +143,8 @@ fire_watch (gpointer data,
                return;
        }
 
+       g_object_ref (watch->monitor);
+
        if (watch->callback) {
                watch->callback (watch->monitor,
                                 watch->id,
@@ -152,6 +154,8 @@ fire_watch (gpointer data,
        if (watch->xalarm == watch->monitor->priv->user_active_alarm) {
                gnome_idle_monitor_remove_watch (watch->monitor, watch->id);
        }
+
+       g_object_unref (watch->monitor);
 }
 
 static void


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