[Xfce4-commits] <thunar:master> Fix crash when opening a mountable drive with no media.

Jannis Pohlmann noreply at xfce.org
Sat Feb 19 16:08:01 CET 2011


Updating branch refs/heads/master
         to f3def301388057f8080d675c8446907d7c62f3bc (commit)
       from bdaafeca93422438c25e76e237bd766cfef71bcf (commit)

commit f3def301388057f8080d675c8446907d7c62f3bc
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sat Feb 19 16:06:27 2011 +0100

    Fix crash when opening a mountable drive with no media.
    
    Error spotted, reported and solved by Ambroz Bizjak.

 NEWS                 |    2 ++
 thunar/thunar-file.c |   24 +++++++++++++-----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index 266a258..686006f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@
 =====
 - Fix crash when trying to thumbnail a file with unknown content type.
 - Fix properties dialog crash with files with unknown content type.
+- Fix crash when opening a mountable drive with no media (bug #7308).
+  Reported and solved by Ambroz Bizjak.
 
 1.3.0
 =====
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index ebb1032..25b16a3 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -702,14 +702,15 @@ thunar_file_load (ThunarFile   *file,
                   GCancellable *cancellable,
                   GError      **error)
 {
-  GKeyFile *key_file;
-  GError   *err = NULL;
-  GFile    *thumbnail_dir;
-  gchar    *base_name;
-  gchar    *md5_hash;
-  gchar    *p;
-  gchar    *thumbnail_dir_path;
-  gchar    *uri = NULL;
+  const gchar *target_uri;
+  GKeyFile    *key_file;
+  GError      *err = NULL;
+  GFile       *thumbnail_dir;
+  gchar       *base_name;
+  gchar       *md5_hash;
+  gchar       *p;
+  gchar       *thumbnail_dir_path;
+  gchar       *uri = NULL;
 
   _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
   _thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -750,9 +751,10 @@ thunar_file_load (ThunarFile   *file,
     {
       if (g_file_info_get_file_type (file->info) == G_FILE_TYPE_MOUNTABLE)
         {
-          file->is_mounted = 
-            !g_file_info_get_attribute_boolean (file->info,
-                                                G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT);
+          target_uri = 
+            g_file_info_get_attribute_string (file->info,
+                                              G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
+          file->is_mounted = (target_uri != NULL);
         }
     }
   else



More information about the Xfce4-commits mailing list