Updating branch refs/heads/master to 171e0d79266b1ad6faedb7e7aee8dffb89b684e5 (commit) from 731cf29b105b3251f2bfdfb50d2aa55bce1f2c36 (commit)
commit 171e0d79266b1ad6faedb7e7aee8dffb89b684e5 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 21c455d..b6f919b 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Xfdesktop 4.x.y * Scroll to the selected background in the settings (bug #7087). * 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