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

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


Updating branch refs/heads/xfce-4.8
         to 2b29bae837016a06c8ee29da44a9486b0909da19 (commit)
       from 76738b76d7d7e77db8f37efc7dab877d11f251bd (commit)

commit 2b29bae837016a06c8ee29da44a9486b0909da19
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                 |    9 ++++++++-
 thunar/thunar-file.c |   27 ++++++++++++++++-----------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/NEWS b/NEWS
index 84240d8..6c3e661 100644
--- a/NEWS
+++ b/NEWS
@@ -2,12 +2,19 @@
 =====
 - Use glib functions for get/set cwd (bug #7522).
 - Revert "Speed up initial start by loading the network item later
-  (bug #7373).
+  (bug #7373)."
+- Revert "Fix crash when opening a mountable drive with no media 
+  (bug #7308)."
+- 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.2.2
 =====
 - 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.
 - Fix crash when hovering a CD drive with a special icon (bug #7309).
   Reported and solved by Ambroz Bizjak.
 - Treat backup files as hidden as with thunar-vfs (bug #7615).
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 7f4df23..12e1556 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