After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769182 - files-view: unref directory after calling _get_by_uri()
files-view: unref directory after calling _get_by_uri()
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-07-26 10:10 UTC by Ernestas Kulik
Modified: 2016-07-28 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
files-view: unref directory after calling _get_by_uri() (1.23 KB, patch)
2016-07-26 10:10 UTC, Ernestas Kulik
committed Details | Review

Description Ernestas Kulik 2016-07-26 10:10:11 UTC
My previous findings were cleanups not being done at the end of execution, which is a questionable practice at best (I read arguments for and against that).
This one is different, however, in that the code is hit during normal operation.
Comment 1 Ernestas Kulik 2016-07-26 10:10:15 UTC
Created attachment 332131 [details] [review]
files-view: unref directory after calling _get_by_uri()

update_scripts_menu() and update_templates_menu() do not unref the
directories after calling nautilus_directory_get_by_uri(), which results
in leaks. This commit fixes that by adding calls to
nautilus_directory_unref().
Comment 2 Carlos Soriano 2016-07-28 07:35:10 UTC
(In reply to Ernestas Kulik from comment #0)
> My previous findings were cleanups not being done at the end of execution,
> which is a questionable practice at best (I read arguments for and against
> that).

Source? Why cleaning up before end of execution would be bad?
Comment 3 Carlos Soriano 2016-07-28 07:38:57 UTC
Review of attachment 332131 [details] [review]:

whops! Thanks much Ernestas! feel free to 3.20 too.
Comment 4 Ernestas Kulik 2016-07-28 07:59:33 UTC
(In reply to Carlos Soriano from comment #2)
> (In reply to Ernestas Kulik from comment #0)
> > My previous findings were cleanups not being done at the end of execution,
> > which is a questionable practice at best (I read arguments for and against
> > that).
> 
> Source? Why cleaning up before end of execution would be bad?

It’s just anecdata I gathered from Stack Overflow and other sites, but, basically, some programmers intentionally don’t do that to achieve quick shutdowns. There was probably something else, but I can’t recall.

The arguments against that, of course, are that this is making assumptions about the memory management of the kernel (I would say that this never applies in practice today) and that cleaning up after yourself in general is a good practice.
Comment 5 Ernestas Kulik 2016-07-28 08:01:51 UTC
Attachment 332131 [details] pushed as 2698802 - files-view: unref directory after calling _get_by_uri()
Comment 6 Carlos Soriano 2016-07-28 11:58:16 UTC
(In reply to Ernestas Kulik from comment #4)
> (In reply to Carlos Soriano from comment #2)
> > (In reply to Ernestas Kulik from comment #0)
> > > My previous findings were cleanups not being done at the end of execution,
> > > which is a questionable practice at best (I read arguments for and against
> > > that).
> > 
> > Source? Why cleaning up before end of execution would be bad?
> 
> It’s just anecdata I gathered from Stack Overflow and other sites, but,
> basically, some programmers intentionally don’t do that to achieve quick
> shutdowns. There was probably something else, but I can’t recall.
> 


> Stack Overflow
> to achieve quick shutdowns

omg