[Xfce4-commits] <thunar:master> Fix crash when opening a drive with no media (bugs #7308 and #7774).

Jannis Pohlmann noreply at xfce.org
Wed Sep 14 20:14:01 CEST 2011


Updating branch refs/heads/master
         to 4406581a896e46b7589a905424b1d99ae762147e (commit)
       from df1b16bfb87cd34630838702669fb5b3889b88a2 (commit)

commit 4406581a896e46b7589a905424b1d99ae762147e
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Wed Sep 14 20:09:18 2011 +0200

    Fix crash when opening a drive with no media (bugs #7308 and #7774).
    
    Patches provided by Ambroz Bizjak and Axel Sommerfeld.

 NEWS                 |    3 +++
 thunar/thunar-file.c |   27 ++++++++++++++++-----------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index 4daa41d..36dc9b2 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@
 - Avoid segfaults due to interpreting display names as format strings.
 - Improve the UI according to bugs #7496 and #7497.
 - Treat backup files as hidden as with thunar-vfs (bug #7615).
+- Fix crash when opening a mountable drive with no media (bug #7308)
+  in a way that does not break SMB shares (#bug 7774).
+  Patches by Ambroz Bizjak and Axel Sommerfeldt.
 
 1.3.0
 =====
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 89eceea..2731ca9 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,13 @@ 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) 
+            && !g_file_info_get_attribute_boolean (file->info, 
+                                                   G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT);
         }
     }
   else


More information about the Xfce4-commits mailing list