[nautilus] desktop-background: make sure to hold a ref in the 'changed' idle



commit a63aaa68f14bec6507d36e856a4ed79d969b1be3
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Jan 25 13:28:09 2011 -0500

    desktop-background: make sure to hold a ref in the 'changed' idle
    
    Otherwise we might end up accessing object fields after it was
    destroyed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=640420

 libnautilus-private/nautilus-desktop-background.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libnautilus-private/nautilus-desktop-background.c b/libnautilus-private/nautilus-desktop-background.c
index 14fa7f4..b853704 100644
--- a/libnautilus-private/nautilus-desktop-background.c
+++ b/libnautilus-private/nautilus-desktop-background.c
@@ -431,6 +431,8 @@ background_change_event_idle_cb (NautilusDesktopBackground *self)
 	gnome_bg_load_from_preferences (self->details->bg,
 					gnome_background_preferences);
 
+	g_object_unref (self);
+
 	return FALSE;
 }
 
@@ -440,10 +442,13 @@ background_settings_change_event_cb (GSettings *settings,
                                      gint       n_keys,
                                      gpointer   user_data)
 {
+	NautilusDesktopBackground *self = user_data;
+
 	/* Need to defer signal processing otherwise
 	 * we would make the dconf backend deadlock.
 	 */
-	g_idle_add ((GSourceFunc) background_change_event_idle_cb, user_data);
+	g_idle_add ((GSourceFunc) background_change_event_idle_cb,
+		    g_object_ref (self));
 
 	return FALSE;
 }



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