[gtk+] places view: Avoid a crash in finalize



commit 6064ed5181087387cf325dcfcd977d18fb3ce3a7
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 2 01:50:51 2015 -0400

    places view: Avoid a crash in finalize
    
    When the places view is finalized before the network loading
    is finished, the async operation is cancelled, and the callback
    accesses the places view while it is already in a state of
    disrepair. Avoid that access.

 gtk/gtkplacesview.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index a2a8395..5fa3c39 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -992,11 +992,8 @@ network_enumeration_finished (GObject      *source_object,
 {
   GtkPlacesViewPrivate *priv;
   GFileEnumerator *enumerator;
-  GtkPlacesView *view;
   GError *error;
 
-  view = GTK_PLACES_VIEW (user_data);
-  priv = gtk_places_view_get_instance_private (view);
   error = NULL;
   enumerator = g_file_enumerate_children_finish (G_FILE (source_object), res, &error);
 
@@ -1010,6 +1007,7 @@ network_enumeration_finished (GObject      *source_object,
     }
   else
     {
+      priv = gtk_places_view_get_instance_private (GTK_PLACES_VIEW (user_data));
       g_file_enumerator_next_files_async (enumerator,
                                           G_MAXINT32,
                                           G_PRIORITY_DEFAULT,


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