Fix ThunarxMenuItem leaks when finalizing ThunarxMenu
Description
thunarx_menu_append_item
and thunarx_menu_prepend_item
take a
reference when adding ThunarxMenuItem objects, so those objects
need to be unreferenced in the finalizer.
I have a few more related leak fixes that I will split up for easier review (and potential bisections in the future).
Leak report
56 bytes in 1 blocks are still reachable in loss record 10,367 of 16,906
at 0x49747C2: malloc (vg_replace_malloc.c:446)
by 0x4C25081: g_malloc (gmem.c:100)
by 0x4C3D614: g_slice_alloc (gslice.c:193)
by 0x4B96EE2: handler_new (gsignal.c:586)
by 0x4B96EE2: g_signal_connect_data (gsignal.c:2527)
by 0xB329574: add_subaction (tvp-git-action.c:209)
by 0xB329D80: tvp_git_action_create_menu_item (tvp-git-action.c:251)
by 0xB329D80: tvp_git_action_new (tvp-git-action.c:162)
by 0xB328BD9: tvp_provider_get_folder_menu_items (tvp-provider.c:501)
by 0x4990AA2: thunarx_menu_provider_get_folder_menu_items (thunarx-menu-provider.c:182)
by 0x40CD5D6: thunar_window_location_toolbar_add_ucas (thunar-window.c:6954)
by 0x40CD5D6: thunar_window_location_toolbar_create (thunar-window.c:6786)
by 0x40CEA42: thunar_window_init (thunar-window.c:1198)
by 0x4B9F9A5: g_type_create_instance (gtype.c:1900)
by 0x4B825AB: g_object_new_internal (gobject.c:2680)
by 0x4B8459D: g_object_new_valist (gobject.c:3018)
by 0x4B84D4B: g_object_new (gobject.c:2494)
by 0x4041896: thunar_application_open_window (thunar-application.c:1501)
by 0x4041CE7: thunar_application_process_files_finish (thunar-application.c:1724)
by 0x4045616: thunar_browser_poke_file_internal (thunar-browser.c:498)
by 0x4045F21: thunar_browser_poke_file (thunar-browser.c:537)
by 0x4040B42: thunar_application_process_files (thunar-application.c:1796)
by 0x4042380: thunar_application_process_filenames (thunar-application.c:1902)
by 0x4042512: thunar_application_command_line (thunar-application.c:580)
[...snip...]
Testing
- No issues were detected when testing the patch with UBSan, LSan, ASan, and Valgrind