diff options
author | Martin Wimpress <[email protected]> | 2015-09-24 10:31:14 +0100 |
---|---|---|
committer | Martin Wimpress <[email protected]> | 2015-09-24 10:31:14 +0100 |
commit | ed33f9d0f57e0b32d85bc0f03d1783c39238449f (patch) | |
tree | 07a53c01e5de639aae516c5877fb3c8f59c585b9 /libcaja-private/caja-undostack-manager.c | |
parent | a050471613f5b7092bce1c0ae87026e91c8e23b4 (diff) | |
parent | 0c1b46500bf0e42f1f9abe3f9152d7604f41cfed (diff) | |
download | caja-ed33f9d0f57e0b32d85bc0f03d1783c39238449f.tar.bz2 caja-ed33f9d0f57e0b32d85bc0f03d1783c39238449f.tar.xz |
Merge pull request #459 from mate-desktop/undo-fix-1.10
[1.10] don't crash on Ctrl-Z after deleting file when original path isn't stored in trash
Diffstat (limited to 'libcaja-private/caja-undostack-manager.c')
-rw-r--r-- | libcaja-private/caja-undostack-manager.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c index 79778460..f989add3 100644 --- a/libcaja-private/caja-undostack-manager.c +++ b/libcaja-private/caja-undostack-manager.c @@ -1974,7 +1974,9 @@ retrieve_files_to_restore (GHashTable * trashed) G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_TIME_MODIFIED - ",trash::orig-path", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, FALSE, NULL); + "," + G_FILE_ATTRIBUTE_TRASH_ORIG_PATH, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, FALSE, NULL); GHashTable *to_restore = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_free); @@ -1983,7 +1985,12 @@ retrieve_files_to_restore (GHashTable * trashed) GFileInfo *info; while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) { /* Retrieve the original file uri */ - const char *origpath = g_file_info_get_attribute_byte_string (info, "trash::orig-path"); + const char *origpath = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH); + if (origpath == NULL) { + g_warning ("The item cannot be restored from trash: could not determine original location"); + continue; + } + GFile *origfile = g_file_new_for_path (origpath); char *origuri = g_file_get_uri (origfile); g_object_unref (origfile); |