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 674236 - Extra ref in e_action_combo_box_set_action()
Extra ref in e_action_combo_box_set_action()
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: general
3.6.x (obsolete)
Other Linux
: Normal critical
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2012-04-17 06:09 UTC by Milan Crha
Modified: 2013-02-19 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtk test patch (1.67 KB, text/plain)
2013-02-18 17:08 UTC, Milan Crha
  Details
proposed gtk patch (partial) (409 bytes, patch)
2013-02-19 11:24 UTC, Milan Crha
none Details | Review
evo patch (908 bytes, patch)
2013-02-19 12:13 UTC, Milan Crha
committed Details | Review

Description Milan Crha 2012-04-17 06:09:04 UTC
Moving this from a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=812923

[abrt] evolution-3.2.3-2.fc16: message_list_set_hidedeleted: Process /usr/bin/evolution was killed by signal 11 (SIGSEGV)

libreport version: 2.0.8
abrt_version:   2.0.7
backtrace_rating: 4
cmdline:        evolution
comment:        Enabled viewing of deleted messages.
crash_function: message_list_set_hidedeleted
executable:     /usr/bin/evolution
kernel:         3.3.1-5.fc16.x86_64
reason:         Process /usr/bin/evolution was killed by signal 11 (SIGSEGV)
time:           Mon 16 Apr 2012 16:03:03 BST

xsession_errors:
:(evolution:2506): evolution-module-mail-CRITICAL **:
e_mail_shell_content_get_mail_view: assertion `E_IS_MAIL_SHELL_CONTENT
(mail_shell_content)' failed
:(evolution:2506): evolution-mail-CRITICAL **: e_mail_reader_get_message_list:
assertion `E_IS_MAIL_READER (reader)' failed

Core was generated by `evolution'.
Program terminated with signal 11, Segmentation fault.

Thread 2 (Thread 0x7f3df40f8700 (LWP 2507))

  • #0 read
    at ../sysdeps/unix/syscall-template.S line 82
  • #1 read
    at /usr/include/bits/unistd.h line 45
  • #2 unix_signal_helper_thread
    at gmain.c line 4567
  • #3 g_thread_create_proxy
    at gthread.c line 1962
  • #4 start_thread
    at pthread_create.c line 309
  • #5 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 115

Thread 1 (Thread 0x7f3dfb216980 (LWP 2506))

  • #0 message_list_set_hidedeleted
    at message-list.c line 4365
  • #1 g_closure_invoke
    at gclosure.c line 774
  • #2 signal_emit_unlocked_R
    at gsignal.c line 3272
  • #3 g_signal_emit_valist
    at gsignal.c line 3003
  • #4 g_signal_emit
    at gsignal.c line 3060
  • #5 _gtk_action_emit_activate
    at gtkaction.c line 799
  • #6 object_set_property
    at gobject.c line 1199
  • #7 g_object_set_property
    at gobject.c line 1929
  • #8 prop_binding_sync_pref_to_prop
    at gconf-bridge.c line 242
  • #9 notify_listener_list
    at gconf-listeners.c line 590
  • #10 ltable_notify
    at gconf-listeners.c line 656
  • #11 gconf_listeners_notify
    at gconf-listeners.c line 185
  • #12 notify_one_entry
    at gconf-client.c line 2835
  • #13 gconf_client_flush_notifies
    at gconf-client.c line 2875
  • #14 notify_idle_callback
    at gconf-client.c line 2769
  • #15 g_main_dispatch
    at gmain.c line 2441
  • #16 g_main_context_dispatch
    at gmain.c line 3011
  • #17 g_main_context_iterate
    at gmain.c line 3089
  • #18 g_main_loop_run
    at gmain.c line 3297
  • #19 gtk_main
    at gtkmain.c line 1362
  • #20 main
    at main.c line 709

Comment 1 Milan Crha 2013-02-12 16:00:19 UTC
Just got it too, in git master. I had opened another mail window, which is currently closed, and I only picked View->Deleted. I was in calendar too. No related warning shown on console.


Thread 1 (Thread 0x7f36ed440a00 (LWP 19473))

  • #0 waitpid
    from /lib64/libpthread.so.0
  • #1 g_spawn_sync
    at gspawn.c line 408
  • #2 g_spawn_command_line_sync
    at gspawn.c line 737
  • #3 run_bug_buddy
    at gnome-segvhanlder.c line 240
  • #4 bugbuddy_segv_handle
    at gnome-segvhanlder.c line 191
  • #5 <signal handler called>
  • #6 e_mail_shell_content_get_mail_view
    at e-mail-shell-content.c line 500
  • #7 action_mail_show_deleted_cb
    at e-mail-shell-view-actions.c line 943
  • #8 g_closure_invoke
    at gclosure.c line 777
  • #9 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #10 g_signal_emit_valist
    at gsignal.c line 3300
  • #11 g_signal_emit
    at gsignal.c line 3356
  • #12 _gtk_action_emit_activate
    from /lib64/libgtk-3.so.0
  • #13 object_set_property
    at gobject.c line 1357
  • #14 g_object_set_property
    at gobject.c line 2154
  • #15 g_settings_binding_key_changed
    at gsettings.c line 2423
  • #16 g_cclosure_marshal_VOID__STRINGv
    at gmarshal.c line 1004
  • #17 _g_closure_invoke_va
    at gclosure.c line 840
  • #18 g_signal_emit_valist
    at gsignal.c line 3211
  • #19 g_signal_emit
    at gsignal.c line 3356
  • #20 g_settings_real_change_event
    at gsettings.c line 288
  • #21 ffi_call_unix64
    from /lib64/libffi.so.5
  • #22 ffi_call
    from /lib64/libffi.so.5
  • #23 g_cclosure_marshal_generic_va
    at gclosure.c line 1550
  • #24 _g_closure_invoke_va
    at gclosure.c line 840
  • #25 g_signal_emit_valist
    at gsignal.c line 3211
  • #26 g_signal_emit
    at gsignal.c line 3356
  • #27 settings_backend_changed
    at gsettings.c line 348
  • #28 g_settings_backend_invoke_closure
    at gsettingsbackend.c line 271
  • #29 g_main_context_invoke_full
    at gmain.c line 4987
  • #30 g_main_context_invoke
    at gmain.c line 4948
  • #31 g_settings_backend_dispatch_signal
    at gsettingsbackend.c line 353
  • #32 g_settings_backend_changed
    at gsettingsbackend.c line 400
  • #33 dconf_engine_emit_changes
    from /usr/lib64/gio/modules/libdconfsettings.so
  • #34 dconf_engine_change_fast
    from /usr/lib64/gio/modules/libdconfsettings.so
  • #35 dconf_settings_backend_write
    from /usr/lib64/gio/modules/libdconfsettings.so
  • #36 g_settings_backend_write
    at gsettingsbackend.c line 778
  • #37 g_settings_write_to_backend
    at gsettings.c line 1025
  • #38 g_settings_binding_property_changed
    at gsettings.c line 2473
  • #39 g_closure_invoke
    at gclosure.c line 777
  • #40 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #41 g_signal_emit_valist
    at gsignal.c line 3300
  • #42 g_signal_emit
    at gsignal.c line 3356
  • #43 g_object_dispatch_properties_changed
    at gobject.c line 1041
  • #44 g_object_notify_by_spec_internal
    at gobject.c line 1135
  • #45 g_object_notify
    at gobject.c line 1177
  • #46 gtk_toggle_action_activate
    from /lib64/libgtk-3.so.0
  • #47 g_closure_invoke
    at gclosure.c line 777
  • #48 signal_emit_unlocked_R
    at gsignal.c line 3481
  • #49 g_signal_emit_valist
    at gsignal.c line 3300
  • #50 g_signal_emit
    at gsignal.c line 3356
  • #51 _gtk_action_emit_activate
    from /lib64/libgtk-3.so.0
  • #52 gtk_check_menu_item_activate
    from /lib64/libgtk-3.so.0
  • #53 g_closure_invoke
    at gclosure.c line 777
  • #54 signal_emit_unlocked_R
    at gsignal.c line 3481
  • #55 g_signal_emit_valist
    at gsignal.c line 3300
  • #56 g_signal_emit
    at gsignal.c line 3356
  • #57 gtk_widget_activate
    from /lib64/libgtk-3.so.0
  • #58 gtk_menu_shell_activate_item
    from /lib64/libgtk-3.so.0
  • #59 _g_closure_invoke_va
    at gclosure.c line 840
  • #60 g_signal_emit_valist
    at gsignal.c line 3211
  • #61 g_signal_emit
    at gsignal.c line 3356
  • #62 gtk_menu_item_mnemonic_activate
    from /lib64/libgtk-3.so.0
  • #63 _gtk_marshal_BOOLEAN__BOOLEAN
    from /lib64/libgtk-3.so.0
  • #64 g_closure_invoke
    at gclosure.c line 777
  • #65 signal_emit_unlocked_R
    at gsignal.c line 3589
  • #66 g_signal_emit_valist
    at gsignal.c line 3310
  • #67 g_signal_emit
    at gsignal.c line 3356
  • #68 gtk_widget_mnemonic_activate
    from /lib64/libgtk-3.so.0
  • #69 _gtk_marshal_BOOLEAN__BOOLEAN
    from /lib64/libgtk-3.so.0
  • #70 g_closure_invoke
    at gclosure.c line 777
  • #71 signal_emit_unlocked_R
    at gsignal.c line 3589
  • #72 g_signal_emit_valist
    at gsignal.c line 3310
  • #73 g_signal_emit
    at gsignal.c line 3356
  • #74 gtk_widget_mnemonic_activate
    from /lib64/libgtk-3.so.0
  • #75 gtk_menu_shell_key_press
    from /lib64/libgtk-3.so.0
  • #76 gtk_menu_key_press
    from /lib64/libgtk-3.so.0
  • #77 _gtk_marshal_BOOLEAN__BOXEDv
    from /lib64/libgtk-3.so.0
  • #78 _g_closure_invoke_va
    at gclosure.c line 840
  • #79 g_signal_emit_valist
    at gsignal.c line 3211
  • #80 g_signal_emit
    at gsignal.c line 3356
  • #81 gtk_widget_event_internal
    from /lib64/libgtk-3.so.0
  • #82 gtk_menu_window_event
    from /lib64/libgtk-3.so.0
  • #83 _gtk_marshal_BOOLEAN__BOXEDv
    from /lib64/libgtk-3.so.0
  • #84 _g_closure_invoke_va
    at gclosure.c line 840
  • #85 g_signal_emit_valist
    at gsignal.c line 3211
  • #86 g_signal_emit
    at gsignal.c line 3356
  • #87 gtk_widget_event_internal
    from /lib64/libgtk-3.so.0
  • #88 propagate_event
    from /lib64/libgtk-3.so.0
  • #89 gtk_main_do_event
    from /lib64/libgtk-3.so.0
  • #90 gdk_event_source_dispatch
    from /lib64/libgdk-3.so.0
  • #91 g_main_dispatch
    at gmain.c line 2715
  • #92 g_main_context_dispatch
    at gmain.c line 3219
  • #93 g_main_context_iterate
    at gmain.c line 3290
  • #94 g_main_loop_run
    at gmain.c line 3484
  • #95 gtk_main
    from /lib64/libgtk-3.so.0
  • #96 main
    at main.c line 698

Comment 2 Milan Crha 2013-02-15 15:53:01 UTC
I see the GtkAction is leaked, or not freed, when the shell window is closed, even the action_group in which the action is stored is properly freed, but I cannot figure out from where the one reference is left on the action.
Comment 3 Milan Crha 2013-02-18 16:51:29 UTC
I'm moving this to gtk+, because I can reproduce it there, within gtk3-demo->Builder demo too.
Comment 4 Milan Crha 2013-02-18 17:08:02 UTC
Created attachment 236631 [details]
gtk test patch

This is a test patch, which adds debugging into gtk3-demo->Builder demo (and fixes possible memory leak of the GtkBuilder pointer as well).

Steps:
a) Patch the demo, compile it, and run gtk3-demo
b) invoke the Builder demo. It'll print approximately this on console:
>   0x1812cf0: weak_reffing builder at 1 ref_count
>   0x173d330: weak_reffing window at 2 ref_count
>   0x1805b30: weak_reffing action_about at 4 ref_count
c) do not do anything in the demo itself, just close the window by clicking
   the "x" button in windows title (or by File->Quit)
   Console will have new messages:
>   0x1812cf0 builder_pointer_gone: builder
>   count_about_action_refs: has refs: 4
>   0x173d330 builder_pointer_gone: window
>   count_about_action_refs: has refs: 1

And the last line shows the problem. Each pointer which is shown at b) with "weak_reffing" is supposed to be also printed in c) as "builder_pointer_gone", but the "action_about" is not printed as such, it's left with one reference, basically leaking and flying nowhere.

The problem in evolution is that the action is invoked on a GSettings change, and the action has a pointer for a freed widget (window/view/...), but the GSettings object still notifies about changes for this action.
Comment 5 Tristan Van Berkom 2013-02-19 06:54:53 UTC
Hmmm, that's a terrible example though, it still uses GtkUIManager.

Do you use a GtkBuilder created UIManager in evolution ?

A normal reference cycle for a GtkAction built by builder would be:

  o GtkBuilder creates the object with a ref count of 1

  o GtkBuilder creates a GtkActivatable widget which refers to the said
    action via it's 'related-action' property, making the action ref count 2

  o GtkBuilder is destroyed, destroying it's internal hash table releases
    a reference to every built object, so the action ref count falls back to 1

  o The top level window(s) is/are destroyed, releasing any references that
    any GtkActivatable widgets might have to their actions, hence disposing
    the actions.
Comment 6 Tristan Van Berkom 2013-02-19 10:20:50 UTC
FWIW, I've tried adding similar debugging to the ui_manager.c demo and
nothing was leaked.

It's my suspicion that the uimanager <ui> parsing code...
Comment 7 Milan Crha 2013-02-19 10:48:27 UTC
As we spoke about this on IRC, I added checks for the uimanager and its action_group, and the uimanager is properly freed, while the action_group is left with one reference (it holds the action, if I unref that one reference on my own, then also the action is freed as expected).

I checked also evolution's .ui files and none of them has GtkUIManager, nor GtkAction in them, and if I recall correctly then the GtkUIManager used by each EShellWindow instance is properly freed.

I hope it helps.
Comment 8 Milan Crha 2013-02-19 11:24:53 UTC
Created attachment 236743 [details] [review]
proposed gtk patch (partial)

for gtk+;

Partial patch, it fixes the builder.c test, but not evolution itself. Note the removed ref is not needed, because gtk_ui_manager_insert_action_group() refs the action group on its own.
Comment 9 Milan Crha 2013-02-19 12:11:01 UTC
I'm moving this back to evolution, because the issue is different from gtk (though it seemed like it's the same thing). I opened bug #694162 for the gtk issue.
Comment 10 Milan Crha 2013-02-19 12:13:44 UTC
Created attachment 236756 [details] [review]
evo patch

for evolution;

All the issue was due to extra reference being added in e_action_combo_box_set_action(), which leaked the group and all its actions.
Comment 11 Milan Crha 2013-02-19 12:19:26 UTC
Created commit 685e763 in evo master (3.7.91+)
Created commit ccee9cb in evo gnome-3-6 (3.6.4+)