Commit 48d626ce authored by Michael Webster's avatar Michael Webster Committed by António Fernandes
Browse files

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
parent fb8e0c4d
Pipeline #288466 passed with stages
in 15 minutes and 32 seconds
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment