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



commit 409cf54b3777351961da9c76925ae7efdba3ece8
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 f62be0f..b623f36 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]