GNOME Bugzilla – Bug 540152
A source is leaked!
Last modified: 2013-09-14 16:52:45 UTC
A source is created, passed to e_source_group_add_source which adds a ref... and the source isn't unreffed! I'll attach a nice patch...
Created attachment 113399 [details] [review] Patch solving the issue
Created attachment 113400 [details] [review] Another similar issue Teuf noticed another problem : when removing a source, it isn't unreffed. Here is a patch to solve this too (untested this time).
+ g_object_unref (source); g_signal_emit (group, signals[SOURCE_REMOVED], 0, source); Not sure if source would be still alive to be passed in the g_signal_emit.
Ah, push that line later down then! I think it would still be alive (after all, the caller certainly still has a ref on it), but indeed it's neater to unref only after the last use!
Looks good and makes sense. Thanks for the patch. Are you willing to post here only one patch, with filled a ChangeLog entry too? It's usually better for tracking. Thanks.
Yes, I'll do.
Created attachment 113457 [details] [review] One-file patch to fix the leaks and add a ChangeLog entry This patch merges both previous patches, but modifies the second one slightly : g_object_unref only after the last use!
Looks good to me.
Thanks, it's in.
regressions :-/ [New Thread 0x428a6950 (LWP 14319)] [Thread 0x428a6950 (LWP 14319) exited] (evolution:14306): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `ESource' (evolution:14306): e-data-server-CRITICAL **: e_source_peek_uid: assertion `E_IS_SOURCE (source)' failed Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7f4ccb90f710 (LWP 14306)] IA__g_str_hash (v=0x0) at gstring.c:95 95 guint32 h = *p; (gdb) t a a bt
+ Trace 201872
Thread 1 (Thread 0x7f4ccb90f710 (LWP 14306))
When ever i move to calender, evolution crashes, always reproducible. I cann't use calendar at all. ==5777== ==5777== Invalid read of size 1 ==5777== at 0x5701FDE: g_type_check_instance_is_a (gtype.c:3697) ==5777== by 0x42FFE7D: compare_source_names (e-source-selector.c:249) ==5777== by 0x5779548: g_slist_sort_real (gslist.c:861) ==5777== by 0x4300985: rebuild_model (e-source-selector.c:275) ==5777== by 0x4301472: e_source_selector_new (e-source-selector.c:392) ==5777== by 0x6349B68: impl_createView (calendar-component.c:1364) ==5777== by 0x402E9E0: _ORBIT_skel_small_GNOME_Evolution_Component_createView (Evolution-common.c:60) ==5777== by 0x4CE2496: ORBit_c_stub_invoke (poa.c:2636) ==5777== by 0x40303C2: GNOME_Evolution_Component_createView (Evolution-stubs.c:96) ==5777== by 0x805B7C1: sidebar_button_selected_callback (e-shell-window.c:248) ==5777== by 0x56F56D9: g_cclosure_marshal_VOID(i_xx_t) (gmarshal.c:216) ==5777== by 0x56E6B7A: g_closure_invoke (gclosure.c:769) ==5777== Address 0x7265737b is not stack'd, malloc'd or (recently) free'd ==5777== ==5777== Process terminating with default action of signal 11 (SIGSEGV) ==5777== Access not within mapped region at address 0x7265737B ==5777== at 0x5701FDE: g_type_check_instance_is_a (gtype.c:3697) ==5777== by 0x42FFE7D: compare_source_names (e-source-selector.c:249) ==5777== by 0x5779548: g_slist_sort_real (gslist.c:861) ==5777== by 0x4300985: rebuild_model (e-source-selector.c:275) ==5777== by 0x4301472: e_source_selector_new (e-source-selector.c:392) ==5777== by 0x6349B68: impl_createView (calendar-component.c:1364) ==5777== by 0x402E9E0: _ORBIT_skel_small_GNOME_Evolution_Component_createView (Evolution-common.c:60) ==5777== by 0x4CE2496: ORBit_c_stub_invoke (poa.c:2636) ==5777== by 0x40303C2: GNOME_Evolution_Component_createView (Evolution-stubs.c:96) ==5777== by 0x805B7C1: sidebar_button_selected_callback (e-shell-window.c:248) ==5777== by 0x56F56D9: g_cclosure_marshal_VOID(i_xx_t) (gmarshal.c:216) ==5777== by 0x56E6B7A: g_closure_invoke (gclosure.c:769) ==5777==
Created attachment 113850 [details] [review] proposed evo patch for evolution; Not the fault of the previous patch, it just showed a wrong code in evolution. It's possible it will bring issues from other parts too.
Created attachment 113853 [details] [review] proposed evo patch ][ for evolution; of course, in address book too...
seems fine, lakhil, can you confirm it works for you?
Yup , patch fixes crash for me.
Committed to trunk. Committed revision 35717.
*** Bug 541292 has been marked as a duplicate of this bug. ***