[nautilus] gtkplacesview: avoid accesing private structure if finalize



commit 4bba25351cef3ca33e30c9c3e7a8fcd8ffbac798
Author: Carlos Soriano <csoriano gnome org>
Date:   Fri Sep 4 21:50:19 2015 +0200

    gtkplacesview: avoid accesing private structure if finalize
    
    We were accesing the private structure on a async callback,
    which can be cancelled on finalize and therefore accesing the
    private structure would be invalid, causing a crash.

 src/gtk/gtkplacesview.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/src/gtk/gtkplacesview.c b/src/gtk/gtkplacesview.c
index af2c5cd..da5c19f 100644
--- a/src/gtk/gtkplacesview.c
+++ b/src/gtk/gtkplacesview.c
@@ -990,23 +990,22 @@ 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);
 
   if (error)
     {
-      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
+          !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
         g_warning ("Failed to fetch network locations: %s", error->message);
 
       g_clear_error (&error);
     }
   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]