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 540152 - A source is leaked!
A source is leaked!
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Contacts
2.24.x (obsolete)
Other All
: Normal blocker
: ---
Assigned To: evolution-addressbook-maintainers
Evolution QA team
: 541292 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-06-25 13:38 UTC by Snark
Modified: 2013-09-14 16:52 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Patch solving the issue (336 bytes, patch)
2008-06-25 13:38 UTC, Snark
reviewed Details | Review
Another similar issue (721 bytes, patch)
2008-06-25 13:50 UTC, Snark
reviewed Details | Review
One-file patch to fix the leaks and add a ChangeLog entry (1.22 KB, patch)
2008-06-26 12:11 UTC, Snark
committed Details | Review
proposed evo patch (2.83 KB, patch)
2008-07-02 11:52 UTC, Milan Crha
none Details | Review
proposed evo patch ][ (4.08 KB, patch)
2008-07-02 12:39 UTC, Milan Crha
committed Details | Review

Description Snark 2008-06-25 13:38:22 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...
Comment 1 Snark 2008-06-25 13:38:59 UTC
Created attachment 113399 [details] [review]
Patch solving the issue
Comment 2 Snark 2008-06-25 13:50:46 UTC
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).
Comment 3 Srinivasa Ragavan 2008-06-25 17:00:24 UTC
+			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.
Comment 4 Snark 2008-06-25 18:21:24 UTC
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!
Comment 5 Milan Crha 2008-06-26 08:54:22 UTC
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.
Comment 6 Snark 2008-06-26 09:35:24 UTC
Yes, I'll do.
Comment 7 Snark 2008-06-26 12:11:02 UTC
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!
Comment 8 Ross Burton 2008-06-26 12:24:17 UTC
Looks good to me.
Comment 9 Snark 2008-06-26 12:54:25 UTC
Thanks, it's in.
Comment 10 Suman Manjunath 2008-07-02 05:35:34 UTC
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

Thread 1 (Thread 0x7f4ccb90f710 (LWP 14306))

  • #0 IA__g_str_hash
    at gstring.c line 95
  • #1 IA__g_hash_table_lookup
    at ghash.c line 118
  • #2 rebuild_model
    at e-source-selector.c line 335
  • #3 e_source_selector_new
    at e-source-selector.c line 392
  • #4 impl_createView
    at calendar-component.c line 1364
  • #5 _ORBIT_skel_small_GNOME_Evolution_Component_createView
    at Evolution-common.c line 60
  • #6 ORBit_c_stub_invoke
    at poa.c line 2636
  • #7 GNOME_Evolution_Component_createView
    at Evolution-stubs.c line 96
  • #8 sidebar_button_selected_callback
    at e-shell-window.c line 248
  • #9 IA__g_closure_invoke
    at gclosure.c line 490
  • #10 signal_emit_unlocked_R
    at gsignal.c line 2440
  • #11 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #12 IA__g_signal_emit
    at gsignal.c line 2243
  • #13 IA__g_closure_invoke
    at gclosure.c line 490
  • #14 signal_emit_unlocked_R
  • #15 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #16 IA__g_signal_emit
    at gsignal.c line 2243
  • #17 gtk_toggle_button_clicked
    at gtktogglebutton.c line 439
  • #18 IA__g_closure_invoke
    at gclosure.c line 490
  • #19 signal_emit_unlocked_R
    at gsignal.c line 2370
  • #20 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #21 IA__g_signal_emit
    at gsignal.c line 2243
  • #22 gtk_toggle_button_released
    at gtktogglebutton.c line 426
  • #23 IA__g_closure_invoke
    at gclosure.c line 490
  • #24 signal_emit_unlocked_R
    at gsignal.c line 2370
  • #25 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #26 IA__g_signal_emit
    at gsignal.c line 2243
  • #27 gtk_button_button_release
    at gtkbutton.c line 1377
  • #28 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 84
  • #29 IA__g_closure_invoke
    at gclosure.c line 490
  • #30 signal_emit_unlocked_R
    at gsignal.c line 2478
  • #31 IA__g_signal_emit_valist
    at gsignal.c line 2209
  • #32 IA__g_signal_emit
    at gsignal.c line 2243
  • #33 gtk_widget_event_internal
    at gtkwidget.c line 4706
  • #34 IA__gtk_propagate_event
    at gtkmain.c line 2343
  • #35 IA__gtk_main_do_event
    at gtkmain.c line 1563
  • #36 gdk_event_dispatch
    at gdkevents-x11.c line 2365
  • #37 IA__g_main_context_dispatch
    at gmain.c line 2066
  • #38 g_main_context_iterate
    at gmain.c line 2699
  • #39 IA__g_main_loop_run
    at gmain.c line 2922
  • #40 bonobo_main
    at bonobo-main.c line 311
  • #41 main
    at main.c line 783

Comment 11 Akhil Laddha 2008-07-02 05:37:55 UTC
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== 
Comment 12 Milan Crha 2008-07-02 11:52:02 UTC
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.
Comment 13 Milan Crha 2008-07-02 12:39:07 UTC
Created attachment 113853 [details] [review]
proposed evo patch  ][

for evolution;

of course, in address book too...
Comment 14 Srinivasa Ragavan 2008-07-03 07:11:34 UTC
seems fine, lakhil, can you confirm it works for you?
Comment 15 Akhil Laddha 2008-07-03 08:33:00 UTC
Yup , patch fixes crash for me.
Comment 16 Milan Crha 2008-07-03 09:32:57 UTC
Committed to trunk. Committed revision 35717.
Comment 17 Akhil Laddha 2009-08-25 12:21:22 UTC
*** Bug 541292 has been marked as a duplicate of this bug. ***