From 6a3dbb0cdcc2c8c3ebfc06f6b4a562bf54a9a7b7 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Sun, 16 May 2021 19:35:34 -0400 Subject: caja-directory.c: Fix memory leak. 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 https://github.com/mate-desktop/python-caja/pull/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: https://github.com/linuxmint/nemo/issues/2736 --- libcaja-private/caja-directory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcaja-private/caja-directory.c b/libcaja-private/caja-directory.c index 8b315e00..1bb1518b 100644 --- a/libcaja-private/caja-directory.c +++ b/libcaja-private/caja-directory.c @@ -923,7 +923,6 @@ 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 { @@ -931,6 +930,7 @@ caja_directory_notify_files_added (GList *files) directory, g_object_ref (location)); } + caja_file_unref (file); caja_directory_unref (directory); } -- cgit v1.2.1