Seens on thunar master and 4.16 when build with ./autogen.sh --enable-debug=full:
--- Leaked a total of 4 ThunarFile objects:--> file:///home/schwinn/software/thunar_test/missing_folder--> file:///home/schwinn/software/thunar_test--> file:///home/schwinn/software/thunar_test/bookmark%20(link)--> file:///home/schwinn/software/thunar_test/bookmark%20(link)/some%20file
No, I simply went through the launcher code (file selection). Since you are more familiar with these parts, I have shared my findings so that you can have a look and maybe identify the remaining leaks.
For the last leaked ThunarFile I only found out that it is only leaked if detailed-view is used. On icon view no leakage is reported.
The leaked file seems to be a random file of the last directory which was entered before closing thunar. It is as well suficcient to just select some file .. no need to change the directory to trigger the leak.
Did not find anything inside thunar-detailes-view and thunar-column-model. So far no idea where it could be leaked.
Pushed now what we found. For the last one I tried alot of things, but now getting out of ideas.
It seems to be related to thunar-detailed-view or thunar-list-model. Though I cant say where exactly.
I just investigated about this, and I found out very cursed, and very informative pattern:
If the if clause in thunar_details_view_row_activated is disabled, the first row that is on the screen gets leaked. If the tree view on the left is used, it also gets leaked. What makes it more confusing is that this is true for about 80% of the time.
@alexxcons Commit bdb2f762 might have fixed the memory leak that wasn't solved. Both master branch and xfce-4.16 no more leaks ThunarFile when using detailed-view. Unfortunately file transfer still causes memory leak.
I looked again at this matter and noticed that the home folder is still being listed in the leak summery. The following line was added recently by @SKefalidis and appears to be the cause:
(In the end was just a missing g_object_unref for the current folder during destruction)
I dont see any more "Leaking ThunarFile Object" warnings when building with ./autogen.sh --enable-debug=full ... hope we finally eliminated all of them. -- closing --
I noticed a new(?) leak related to desktop launchers when opening the folder containing those files:
--- Leaked a total of 2 ThunarFile objects:--> file:///home/lastonestanding/Desktop/xfce4-about.desktop--> file:///home/lastonestanding/Desktop/xfce-keyboard-settings.desktop
Found a new one (on current master/~4.19.2). To reproduce:
Run Thunar in terminal, if "restore-tabs" isn't enabled - enable and restart
Change directory & close (also reproducible when closing new windows while first one still runs)
Result: URI(s) saved in "last-tabs-left/right" during the previous/first run leak. In other words, it seems to happen when/if "last-tabs-left/right" get overwritten with new URI's (previous ones are then leaked)...
I tested only with icon-view, though I suppose it doesn't really matter.
Tracked it down in thunar_application_command_line. Not 100% sure if done correctly but this fixes it for me without "complaints", either from compiler or during runtime: fix_leak_on_window_close_with_restore_tabs_enabled.patch
It's likely needed on 4.18 as well, however there's another leak there which happens with or without the patch^^, if split-view is enabled (either on startup up, or manually after), with or without changing directories.
In short: opening (+toggling split-view if not on already) and closing Thunar is enough to trigger the leak.
Haven't found the cause yet (it is however fixed in 4.19.2).
You're very welcome! It was a pleasure to both contribute and to locate/plug a first leak ever (if memory serves me)
I tweaked the patch a bit (to as well release in the very unlikely case of non-folder files) and pushed it: e4ad0d0e
Lolz, I was so focused on keeping it simple and reusing the existing if (dir != NULL) check that I didn't even register the need to check if dir is a file
I as well will happily push fixes for 4.18 leaks
I'll share whatever I find and/or fix!
though I suppose it is not worth the effort there.