Updating branch refs/heads/xfce-4.8
         to dde9240481e70a2b63dc16b0f3afe353448f60ae (commit)
       from 2753cf8f17085e17e40004436b382fc6478d8c51 (commit)

commit dde9240481e70a2b63dc16b0f3afe353448f60ae
Author: Jannis Pohlmann <jan...@xfce.org>
Date:   Sun Jan 30 14:19:08 2011 +0100

    Fix crash when cancelling a file download (bug #6876).
    
    Apparently, there are situations where a G_FILE_MONITOR_EVENT_CHANGED
    event is triggered for an existing file that has no GFileInfo any more.
    This commits removes an assertion that the GFileInfo is valid in those
    situations and instead, destroys the file icon when it's not.
    
    Also, this commit switches from G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT
    to G_FILE_MONITOR_EVENT_CHANGED although it shouldn't really matter
    which one we use.

 NEWS                              |    1 +
 src/xfdesktop-file-icon-manager.c |   19 ++++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index f8ada79..6e686c8 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Xfdesktop 4.x.y
   * Handle volume changes in a timeout (bug #7025).
   * Implement monitoring for special file icons (bug #6986).
   * Implement open and empty actions for the trash.
+  * Fix crash when cancelling a file download (bug #6876).
 
 
 Xfdesktop 4.8.0
diff --git a/src/xfdesktop-file-icon-manager.c 
b/src/xfdesktop-file-icon-manager.c
index 7362c52..c85c08d 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -2135,19 +2135,24 @@ xfdesktop_file_icon_manager_file_changed(GFileMonitor   
  *monitor,
     GFileInfo *file_info;
 
     switch(event) {
-        case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
-            DBG("got changes done hint event: %s", g_file_get_path(file));
+        case G_FILE_MONITOR_EVENT_CHANGED:
+            DBG("got changed event: %s", g_file_get_path(file));
             
             icon = g_hash_table_lookup(fmanager->priv->icons, file);
             if(icon) {
                 file_info = g_file_query_info(file, 
XFDESKTOP_FILE_INFO_NAMESPACE,
                                               G_FILE_QUERY_INFO_NONE, NULL, 
NULL);
                 
-                /* the file info query HAS to succeed because the file still 
exists */
-                g_assert(file_info);
-
-                xfdesktop_file_icon_update_file_info(icon, file_info);
-                g_object_unref(file_info);
+                if(file_info) {
+                    /* update the icon if the file still exists */
+                    xfdesktop_file_icon_update_file_info(icon, file_info);
+                    g_object_unref(file_info);
+                } else {
+                    /* remove the icon as the file no longer seems to be 
existing */
+                    xfdesktop_icon_view_remove_item(fmanager->priv->icon_view,
+                                                    XFDESKTOP_ICON(icon));
+                    g_hash_table_remove(fmanager->priv->icons, file);
+                }
             }
             break;
         case G_FILE_MONITOR_EVENT_CREATED:
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to