GNOME Bugzilla – Bug 346401
nautilus doesn't finalize extensions
Last modified: 2008-02-12 09:56:54 UTC
nautilus_module_shutdown() is not being called for loaded extensions when nautilus exits normally.
Created attachment 68263 [details] [review] patch
it's been almost a year, ping! :P
Thanks and sorry for the delay. I committed something based on your patch on HEAD: It uses the eel_debug_shutdown_* infrastructure to install a shutdown call to the existing nautilus_module_extension_list_free function. 2007-06-23 Martin Wehner <martin.wehner@gmail.com> * libnautilus-private/nautilus-module.c: (nautilus_module_init): Unref extension modules at shutdown. (#346401) Based on patch from Gustavo Carneiro <gjc@inescporto.pt>
Could this be what's causing the invalid reads I see when running under valgrind: ==14141== Invalid read of size 4 ==14141== at 0x8121B4A: nautilus_module_extension_list_free (nautilus-module.c:249) ==14141== by 0x405D7FB: eel_debug_shut_down (eel-debug.c:110) ==14141== by 0x807BE53: main (nautilus-main.c:563) ==14141== Address 0x5B1F0C4 is 4 bytes inside a block of size 12 free'd ==14141== at 0x402213F: free (vg_replace_malloc.c:233) ==14141== by 0x4FDE340: g_free (gmem.c:187) ==14141== by 0x4FF29B6: g_slice_free1 (gslice.c:886) ==14141== by 0x4FD4D9F: g_list_remove (glist.c:231) ==14141== by 0x8121B06: module_object_weak_notify (nautilus-module.c:148) ==14141== by 0x4F7B840: weak_refs_notify (gobject.c:1466) ==14141== by 0x4FC4AE6: g_datalist_id_set_data_full (gdataset.c:242) ==14141== by 0x4F7BF28: g_object_real_dispose (gobject.c:534) ==14141== by 0x4F7C17A: g_object_unref (gobject.c:1765) ==14141== by 0x8121B49: nautilus_module_extension_list_free (nautilus-module.c:250) ==14141== by 0x405D7FB: eel_debug_shut_down (eel-debug.c:110) ==14141== by 0x807BE53: main (nautilus-main.c:563) ==14141== ==14141== Invalid read of size 4 ==14141== at 0x4FF35B1: g_slice_free_chain_with_offset (gslice.c:955) ==14141== by 0x4FD4DF0: g_list_free (glist.c:53) ==14141== by 0x8121B58: nautilus_module_extension_list_free (nautilus-module.c:252) ==14141== by 0x405D7FB: eel_debug_shut_down (eel-debug.c:110) ==14141== by 0x807BE53: main (nautilus-main.c:563) ==14141== Address 0x5B1F0C4 is 4 bytes inside a block of size 12 free'd ==14141== at 0x402213F: free (vg_replace_malloc.c:233) ==14141== by 0x4FDE340: g_free (gmem.c:187) ==14141== by 0x4FF29B6: g_slice_free1 (gslice.c:886) ==14141== by 0x4FD4D9F: g_list_remove (glist.c:231) ==14141== by 0x8121B06: module_object_weak_notify (nautilus-module.c:148) ==14141== by 0x4F7B840: weak_refs_notify (gobject.c:1466) ==14141== by 0x4FC4AE6: g_datalist_id_set_data_full (gdataset.c:242) ==14141== by 0x4F7BF28: g_object_real_dispose (gobject.c:534) ==14141== by 0x4F7C17A: g_object_unref (gobject.c:1765) ==14141== by 0x8121B49: nautilus_module_extension_list_free (nautilus-module.c:250) ==14141== by 0x405D7FB: eel_debug_shut_down (eel-debug.c:110) ==14141== by 0x807BE53: main (nautilus-main.c:563) ==14141== ==14141== Invalid write of size 1 ==14141== at 0x4023654: memset (mc_replace_strmem.c:490) ==14141== by 0x4FF376A: g_slice_free_chain_with_offset (gslice.c:960) ==14141== by 0x4FD4DF0: g_list_free (glist.c:53) ==14141== by 0x8121B58: nautilus_module_extension_list_free (nautilus-module.c:252) ==14141== by 0x405D7FB: eel_debug_shut_down (eel-debug.c:110) ==14141== by 0x807BE53: main (nautilus-main.c:563) ==14141== Address 0x5B1F0C0 is 0 bytes inside a block of size 12 free'd ==14141== at 0x402213F: free (vg_replace_malloc.c:233) ==14141== by 0x4FDE340: g_free (gmem.c:187) ==14141== by 0x4FF29B6: g_slice_free1 (gslice.c:886) ==14141== by 0x4FD4D9F: g_list_remove (glist.c:231) ==14141== by 0x8121B06: module_object_weak_notify (nautilus-module.c:148) ==14141== by 0x4F7B840: weak_refs_notify (gobject.c:1466) ==14141== by 0x4FC4AE6: g_datalist_id_set_data_full (gdataset.c:242) ==14141== by 0x4F7BF28: g_object_real_dispose (gobject.c:534) ==14141== by 0x4F7C17A: g_object_unref (gobject.c:1765) ==14141== by 0x8121B49: nautilus_module_extension_list_free (nautilus-module.c:250) ==14141== by 0x405D7FB: eel_debug_shut_down (eel-debug.c:110) ==14141== by 0x807BE53: main (nautilus-main.c:563) ==14141==
Yes it does. If you want to do something like that, it should be something like: void nautilus_module_extension_list_free (gpointer data) { GList *l, *next; for (l = module_objects; l != NULL; l = next) { next = l->next; g_object_unref (l->data); } g_list_free (module_objects); }
fixed in svn
reverted fix due to hard code freeze.
Re-applied to HEAD. Closing.
Bug 480807 may be a dup
*** Bug 515913 has been marked as a duplicate of this bug. ***