[gvfs] Revert "trash: Don't use try_ for blocking methods"



commit 01fe5a61c01a1b4ad24a2cb6a280183cc774de4b
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Sun Feb 2 17:07:03 2014 +0000

    Revert "trash: Don't use try_ for blocking methods"
    
    This reverts commit 052682c8a22bf8d7c86fb0f086a119dd7fec4c6b.
    
    This may have caused a race condition causing failed assertions; since
    it is not important, revert for now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723305

 daemon/gvfsbackendtrash.c |   80 ++++++++++++++++++++++++++++----------------
 1 files changed, 51 insertions(+), 29 deletions(-)
---
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c
index b199d59..1f6e624 100644
--- a/daemon/gvfsbackendtrash.c
+++ b/daemon/gvfsbackendtrash.c
@@ -220,7 +220,7 @@ trash_backend_get_file (GVfsBackendTrash  *backend,
 }
 
 /* ======================= method implementations ======================= */
-static void
+static gboolean
 trash_backend_open_for_read (GVfsBackend        *vfs_backend,
                              GVfsJobOpenForRead *job,
                              const char         *filename)
@@ -251,16 +251,18 @@ trash_backend_open_for_read (GVfsBackend        *vfs_backend,
               g_vfs_job_open_for_read_set_can_seek (job, TRUE);
               g_vfs_job_succeeded (G_VFS_JOB (job));
 
-              return;
+              return TRUE;
             }
         }
     }
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
+
+  return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_read (GVfsBackend       *backend,
                     GVfsJobRead       *job,
                     GVfsBackendHandle  handle,
@@ -278,14 +280,16 @@ trash_backend_read (GVfsBackend       *backend,
       g_vfs_job_read_set_size (job, bytes);
       g_vfs_job_succeeded (G_VFS_JOB (job));
 
-      return;
+      return TRUE;
     }
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
+
+  return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_seek_on_read (GVfsBackend       *backend,
                             GVfsJobSeekRead   *job,
                             GVfsBackendHandle  handle,
@@ -299,14 +303,16 @@ trash_backend_seek_on_read (GVfsBackend       *backend,
       g_vfs_job_seek_read_set_offset (job, g_seekable_tell (handle));
       g_vfs_job_succeeded (G_VFS_JOB (job));
 
-      return;
+      return TRUE;
     }
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
+
+  return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_close_read (GVfsBackend       *backend,
                           GVfsJobCloseRead  *job,
                           GVfsBackendHandle  handle)
@@ -318,13 +324,15 @@ trash_backend_close_read (GVfsBackend       *backend,
       g_vfs_job_succeeded (G_VFS_JOB (job));
       g_object_unref (handle);
 
-      return;
+      return TRUE;
     }
 
   g_object_unref (handle);
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
+
+  return TRUE;
 }
 
 static gboolean
@@ -349,7 +357,7 @@ trash_backend_schedule_thaw (GVfsBackendTrash *backend)
                                             backend);
 }
 
-static void
+static gboolean
 trash_backend_delete (GVfsBackend   *vfs_backend,
                       GVfsJobDelete *job,
                       const char    *filename)
@@ -387,7 +395,7 @@ trash_backend_delete (GVfsBackend   *vfs_backend,
                   g_vfs_job_succeeded (G_VFS_JOB (job));
                   trash_item_unref (item);
 
-                  return;
+                  return TRUE;
                 }
             }
 
@@ -397,9 +405,11 @@ trash_backend_delete (GVfsBackend   *vfs_backend,
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
+  
+  return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_pull (GVfsBackend           *vfs_backend,
                     GVfsJobPull           *job,
                     const gchar           *source,
@@ -452,7 +462,7 @@ trash_backend_pull (GVfsBackend           *vfs_backend,
                   trash_item_unref (item);
                   g_object_unref (real);
 
-                  return;
+                  return TRUE;
                 }
             }
 
@@ -464,6 +474,8 @@ trash_backend_pull (GVfsBackend           *vfs_backend,
 
   g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
   g_error_free (error);
+  
+  return TRUE;
 }
 
 static void
@@ -621,7 +633,7 @@ trash_backend_enumerate_non_root (GVfsBackendTrash      *backend,
   g_error_free (error);
 }
 
-static void
+static gboolean
 trash_backend_enumerate (GVfsBackend           *vfs_backend,
                          GVfsJobEnumerate      *job,
                          const char            *filename,
@@ -639,9 +651,11 @@ trash_backend_enumerate (GVfsBackend           *vfs_backend,
                                       attribute_matcher, flags);
   else
     trash_backend_enumerate_root (backend, job, attribute_matcher, flags);
+
+  return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_mount (GVfsBackend  *vfs_backend,
                      GVfsJobMount *job,
                      GMountSpec   *mount_spec,
@@ -659,9 +673,11 @@ trash_backend_mount (GVfsBackend  *vfs_backend,
   backend->watcher = trash_watcher_new (backend->root);
 
   g_vfs_job_succeeded (G_VFS_JOB (job));
+
+  return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_query_info (GVfsBackend           *vfs_backend,
                           GVfsJobQueryInfo      *job,
                           const char            *filename,
@@ -702,7 +718,7 @@ trash_backend_query_info (GVfsBackend           *vfs_backend,
               trash_item_unref (item);
               g_object_unref (real_info);
 
-              return;
+              return TRUE;
             }
 
           trash_item_unref (item);
@@ -736,6 +752,8 @@ trash_backend_query_info (GVfsBackend           *vfs_backend,
 
       g_vfs_job_succeeded (G_VFS_JOB (job));
     }
+
+  return TRUE;
 }
 
 static gboolean
@@ -762,7 +780,7 @@ trash_backend_query_fs_info (GVfsBackend           *vfs_backend,
   return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_create_dir_monitor (GVfsBackend          *vfs_backend,
                                   GVfsJobCreateMonitor *job,
                                   const char           *filename,
@@ -779,9 +797,11 @@ trash_backend_create_dir_monitor (GVfsBackend          *vfs_backend,
   g_vfs_job_create_monitor_set_monitor (job, monitor);
   g_vfs_job_succeeded (G_VFS_JOB (job));
   g_object_unref (monitor);
+
+  return TRUE;
 }
 
-static void
+static gboolean
 trash_backend_create_file_monitor (GVfsBackend          *vfs_backend,
                                    GVfsJobCreateMonitor *job,
                                    const char           *filename,
@@ -798,6 +818,8 @@ trash_backend_create_file_monitor (GVfsBackend          *vfs_backend,
   g_vfs_job_create_monitor_set_monitor (job, monitor);
   g_vfs_job_succeeded (G_VFS_JOB (job));
   g_object_unref (monitor);
+
+  return TRUE;
 }
 
 static void
@@ -845,16 +867,16 @@ g_vfs_backend_trash_class_init (GVfsBackendTrashClass *class)
 
   gobject_class->finalize = trash_backend_finalize;
 
-  backend_class->mount = trash_backend_mount;
-  backend_class->open_for_read = trash_backend_open_for_read;
-  backend_class->read = trash_backend_read;
-  backend_class->seek_on_read = trash_backend_seek_on_read;
-  backend_class->close_read = trash_backend_close_read;
-  backend_class->query_info = trash_backend_query_info;
+  backend_class->try_mount = trash_backend_mount;
+  backend_class->try_open_for_read = trash_backend_open_for_read;
+  backend_class->try_read = trash_backend_read;
+  backend_class->try_seek_on_read = trash_backend_seek_on_read;
+  backend_class->try_close_read = trash_backend_close_read;
+  backend_class->try_query_info = trash_backend_query_info;
   backend_class->try_query_fs_info = trash_backend_query_fs_info;
-  backend_class->enumerate = trash_backend_enumerate;
-  backend_class->delete = trash_backend_delete;
-  backend_class->pull = trash_backend_pull;
-  backend_class->create_dir_monitor = trash_backend_create_dir_monitor;
-  backend_class->create_file_monitor = trash_backend_create_file_monitor;
+  backend_class->try_enumerate = trash_backend_enumerate;
+  backend_class->try_delete = trash_backend_delete;
+  backend_class->try_pull = trash_backend_pull;
+  backend_class->try_create_dir_monitor = trash_backend_create_dir_monitor;
+  backend_class->try_create_file_monitor = trash_backend_create_file_monitor;
 }


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