summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Webster <miketwebster@gmail.com>2021-05-16 20:24:16 -0400
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2021-06-07 18:17:58 +0000
commit48d626cea93230561556cd84dad2d9d78939b1dc (patch)
tree0fa509dcc74ced386d7e77d57de11e94520b3ba6
parentfb8e0c4d41760248f5793ca30fbd29db682fa19d (diff)
downloadnautilus-48d626cea93230561556cd84dad2d9d78939b1dc.tar.gz
nautilus-directory.c: Fix a memory leak.
When creating a new file using a template, it's possible for is_added to be FALSE, so make sure the file is unref'd regardless. This actually resolves an issue in caja and nemo which is caused by files created in this manner not being finalized when no longer in use. I can reproduce the issue with nautilus, but this *does not* fix it, so I think that there may be an additional leak somewhere else (maybe not related to template-created files). 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. Original report: https://github.com/linuxmint/nemo/issues/2736
-rw-r--r--src/nautilus-directory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index 527b6bf93..f54ad5aac 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -1289,7 +1289,6 @@ nautilus_directory_notify_files_added (GList *files)
* If it was renamed this could be ignored, but
* queue a change just in case */
nautilus_file_changed (file);
- nautilus_file_unref (file);
}
else
{
@@ -1297,6 +1296,7 @@ nautilus_directory_notify_files_added (GList *files)
directory,
g_object_ref (location));
}
+ nautilus_file_unref (file);
nautilus_directory_unref (directory);
}