Skip to content

Commit

Permalink
nemo-directory.c: Fix previous commit which altered potential
Browse files Browse the repository at this point in the history
behavior more than necessary.

nemo_file_unref is null safe so just move it out and leave the
original logic alone.
  • Loading branch information
mtwebster committed May 16, 2021
1 parent 73aafd8 commit 463eca2
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions libnemo-private/nemo-directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,28 +972,25 @@ nemo_directory_notify_files_added (GList *files)
continue;
}

file = nemo_file_get_existing (location);
/* We check is_added here, because the file could have been added
* to the directory by a nemo_file_get() but not gotten
* files_added emitted
*/
if (file != NULL) {
if (file->details->is_added) {
/* A file already exists, it was probably renamed
* If it was renamed this could be ignored, but
* queue a change just in case */
nemo_file_changed (file);
} else {
hash_table_list_prepend (added_lists,
directory,
g_object_ref (location));
}

nemo_file_unref (file);
file = nemo_file_get_existing (location);
/* We check is_added here, because the file could have been added
* to the directory by a nemo_file_get() but not gotten
* files_added emitted
*/
if (file && file->details->is_added) {
/* A file already exists, it was probably renamed.
* If it was renamed this could be ignored, but
* queue a change just in case */
nemo_file_changed (file);
} else {
hash_table_list_prepend (added_lists,
directory,
g_object_ref (location));
}

nemo_directory_unref (directory);
}
nemo_file_unref (file);
nemo_directory_unref (directory);
}

/* Now get file info for the new files. This creates NemoFile
* objects for the new files, and sends out a files_added signal.
Expand Down

0 comments on commit 463eca2

Please sign in to comment.