[gnome-control-center] background: Fix crash if a BgRecentSource is unreffed during an async operation



commit 5183faea041b27e2a6888da4b9819ccf507c3233
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Oct 15 17:03:58 2019 +1300

    background: Fix crash if a BgRecentSource is unreffed during an async operation
    
    The BG_RECENT_SOURCE (user_data) call was done before it was checked if is was
    cancelled. At this point user_data is pointing to an object that has been deleted.
    
    Fixes #729

 panels/background/bg-recent-source.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/panels/background/bg-recent-source.c b/panels/background/bg-recent-source.c
index 44eec5564..13e583fdc 100644
--- a/panels/background/bg-recent-source.c
+++ b/panels/background/bg-recent-source.c
@@ -264,7 +264,7 @@ enumerate_children_finished_cb (GObject      *source,
                                 GAsyncResult *result,
                                 gpointer      user_data)
 {
-  BgRecentSource *self = BG_RECENT_SOURCE (user_data);
+  BgRecentSource *self;
   g_autoptr(GFileEnumerator) enumerator = NULL;
   g_autoptr(GError) error = NULL;
 
@@ -277,6 +277,7 @@ enumerate_children_finished_cb (GObject      *source,
       return;
     }
 
+  self = BG_RECENT_SOURCE (user_data);
   g_file_enumerator_next_files_async (enumerator,
                                       G_MAXINT,
                                       G_PRIORITY_DEFAULT,


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