Skip to content

Commit

Permalink
caja-directory.c: Fix memory leak.
Browse files Browse the repository at this point in the history
When creating a new file (using a template, for instance), file->
details->is_added could potentially be FALSE, and cause this file to
not be finalized along with other files if the view directory is
destroyed.

This can cause issues when re-entering that directory, with the file
being in an undefined state, and could prevent the view from fully
loading the location (this is identical behavior to that described
in mate-desktop/python-caja#64.

To reproduce:
- Create an svg file and save in ~/Templates.
- Right-click, Create document-> svg file, name it whatever.
- Navigate out of the folder.
- Modify the file in a visible manner.
- Re-enter the folder, note that it never finishes loading.

Ref:
linuxmint/nemo#2736
  • Loading branch information
mtwebster committed May 16, 2021
1 parent 46e02ca commit 19d5d87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libcaja-private/caja-directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,14 +923,14 @@ caja_directory_notify_files_added (GList *files)
* If it was renamed this could be ignored, but
* queue a change just in case */
caja_file_changed (file);
caja_file_unref (file);
}
else
{
hash_table_list_prepend (added_lists,
directory,
g_object_ref (location));
}
caja_file_unref (file);
caja_directory_unref (directory);
}

Expand Down

0 comments on commit 19d5d87

Please sign in to comment.