Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tray: cairo_surface_reference assertion failure #11984

Closed
Green-Sky opened this issue Jan 16, 2025 · 8 comments
Closed

tray: cairo_surface_reference assertion failure #11984

Green-Sky opened this issue Jan 16, 2025 · 8 comments
Assignees
Milestone

Comments

@Green-Sky
Copy link
Contributor

Green-Sky commented Jan 16, 2025

Having the tray exist can cause a random crash.

Linux (nixos) using libayatana-appindicator

commit 355f69e

../src/cairo-surface.c:938: cairo_surface_reference: Assertion `CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count)' failed.

Thread 2 "tray gtk" received signal SIGABRT, Aborted.
[Switching to LWP 1515785]
0x00007ffff74a2efc in __pthread_kill_implementation () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
(gdb) bt
#0  0x00007ffff74a2efc in __pthread_kill_implementation () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#1  0x00007ffff7452e86 in raise () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#2  0x00007ffff743b935 in abort () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#3  0x00007ffff743b859 in __assert_fail_base.cold () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#4  0x00007ffff744b6e6 in __assert_fail () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#5  0x00007ffff0e037ad in cairo_surface_reference () from /nix/store/ag0yl2kh55ab1n3jq9d3ha0z0qi8krm2-cairo-1.18.0/lib/libcairo.so.2
#6  0x00007ffff0db9d68 in _cairo_gstate_init () from /nix/store/ag0yl2kh55ab1n3jq9d3ha0z0qi8krm2-cairo-1.18.0/lib/libcairo.so.2
#7  0x00007ffff0db6514 in _cairo_default_context_create () from /nix/store/ag0yl2kh55ab1n3jq9d3ha0z0qi8krm2-cairo-1.18.0/lib/libcairo.so.2
#8  0x00007ffff11cb4ab in get_surface_size () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#9  0x00007ffff11cbf46 in _gtk_icon_helper_get_size () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#10 0x00007ffff11e0eab in gtk_image_render_contents () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#11 0x00007ffff112dbbd in gtk_css_custom_gadget_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#12 0x00007ffff1133bff in gtk_css_gadget_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#13 0x00007ffff11e08f1 in gtk_image_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#14 0x00007ffff135d424 in gtk_widget_draw_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#15 0x00007ffff1127aa1 in gtk_container_propagate_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#16 0x00007ffff1127bac in gtk_container_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#17 0x00007ffff141344e in gtk_tray_icon_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#18 0x00007ffff135d424 in gtk_widget_draw_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#19 0x00007ffff13668a8 in gtk_widget_render () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#20 0x00007ffff12079bf in gtk_main_do_event () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#21 0x00007ffff18ec745 in _gdk_event_emit () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#22 0x00007ffff18fb689 in _gdk_window_process_updates_recurse_helper () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#23 0x00007ffff18fd296 in gdk_window_process_updates_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#24 0x00007ffff18fd497 in gdk_window_process_updates_with_mode () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#25 0x00007ffff1860861 in _g_closure_invoke_va () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#26 0x00007ffff187669c in signal_emit_valist_unlocked () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#27 0x00007ffff187c2c2 in g_signal_emit_valist () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#28 0x00007ffff187c36f in g_signal_emit () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#29 0x00007ffff18f5a8f in gdk_frame_clock_paint_idle () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#30 0x00007ffff18e1b37 in gdk_threads_dispatch () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#31 0x00007ffff0aaec7a in g_timeout_dispatch () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#32 0x00007ffff0aaae39 in g_main_dispatch () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#33 0x00007ffff0aadfd7 in g_main_context_iterate_unlocked.isra () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#34 0x00007ffff0aae88f in g_main_loop_run () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#35 0x00007ffff1206b35 in gtk_main () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#36 0x00000000005c837c in main_gtk_thread (data=data@entry=0x0) at /nix/store/ypyyh34hziz6psvyb3z004dczv9x19ya-source/src/tray/unix/SDL_tray.c:133
#37 0x0000000000587125 in SDL_RunThread (thread=0x1fc9b20) at /nix/store/ypyyh34hziz6psvyb3z004dczv9x19ya-source/src/thread/SDL_thread.c:328
#38 0x00000000005d5541 in RunThread (data=<optimized out>) at /nix/store/ypyyh34hziz6psvyb3z004dczv9x19ya-source/src/thread/pthread/SDL_systhread.c:73
#39 0x00007ffff74a1272 in start_thread () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#40 0x00007ffff751cdec in clone3 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
(gdb) info threads
  Id   Target Id                    Frame
  1    LWP 1515781 "tomato"         0x00007ffff7464a29 in __mpn_divrem () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
* 2    LWP 1515785 "tray gtk"       0x00007ffff74a2efc in __pthread_kill_implementation () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  3    LWP 1515786 "pool-spawner"   0x00007ffff751ad1d in syscall () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  4    LWP 1515787 "gmain"          0x00007ffff750f62f in poll () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  7    LWP 1515790 "gdbus"          0x00007ffff750f62f in poll () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  8    LWP 1515791 "tomato"         0x00007ffff74e90c5 in clock_nanosleep@GLIBC_2.2.5 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  9    LWP 1515792 "tray gtk"       0x00007ffff751ad1d in syscall () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  10   LWP 1515801 "pw-data-loop"   0x00007ffff751d206 in epoll_wait () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  11   LWP 1515802 "SDLPwAudioPlug" 0x00007ffff751d206 in epoll_wait () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6

Same crash also previously reported in #11893

tomato: ../src/cairo-surface.c:938: cairo_surface_reference: Assertion `CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count)' failed.

Thread 2 "tray gtk" received signal SIGABRT, Aborted.
[Switching to LWP 624082]
0x00007ffff74a2efc in __pthread_kill_implementation ()
   from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
(gdb) bt
#0  0x00007ffff74a2efc in __pthread_kill_implementation () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#1  0x00007ffff7452e86 in raise () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#2  0x00007ffff743b935 in abort () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#3  0x00007ffff743b859 in __assert_fail_base.cold () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#4  0x00007ffff744b6e6 in __assert_fail () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#5  0x00007ffff0e037ad in cairo_surface_reference () from /nix/store/ag0yl2kh55ab1n3jq9d3ha0z0qi8krm2-cairo-1.18.0/lib/libcairo.so.2
#6  0x00007ffff0db9d68 in _cairo_gstate_init () from /nix/store/ag0yl2kh55ab1n3jq9d3ha0z0qi8krm2-cairo-1.18.0/lib/libcairo.so.2
#7  0x00007ffff0db6514 in _cairo_default_context_create () from /nix/store/ag0yl2kh55ab1n3jq9d3ha0z0qi8krm2-cairo-1.18.0/lib/libcairo.so.2
#8  0x00007ffff11cb4ab in get_surface_size () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#9  0x00007ffff11cbf46 in _gtk_icon_helper_get_size () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#10 0x00007ffff11e0eab in gtk_image_render_contents () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#11 0x00007ffff112dbbd in gtk_css_custom_gadget_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#12 0x00007ffff1133bff in gtk_css_gadget_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#13 0x00007ffff11e08f1 in gtk_image_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#14 0x00007ffff135d424 in gtk_widget_draw_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#15 0x00007ffff1127aa1 in gtk_container_propagate_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#16 0x00007ffff1127bac in gtk_container_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#17 0x00007ffff141344e in gtk_tray_icon_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#18 0x00007ffff135d424 in gtk_widget_draw_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#19 0x00007ffff13668a8 in gtk_widget_render () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#20 0x00007ffff12079bf in gtk_main_do_event () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#21 0x00007ffff18ec745 in _gdk_event_emit () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#22 0x00007ffff18fb689 in _gdk_window_process_updates_recurse_helper () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#23 0x00007ffff18fd296 in gdk_window_process_updates_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#24 0x00007ffff18fd497 in gdk_window_process_updates_with_mode () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#25 0x00007ffff1833861 in _g_closure_invoke_va () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#26 0x00007ffff184969c in signal_emit_valist_unlocked () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#27 0x00007ffff184f2c2 in g_signal_emit_valist () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#28 0x00007ffff184f36f in g_signal_emit () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#29 0x00007ffff18f5a8f in gdk_frame_clock_paint_idle () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#30 0x00007ffff18e1b37 in gdk_threads_dispatch () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#31 0x00007ffff0aaec7a in g_timeout_dispatch () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#32 0x00007ffff0aaae39 in g_main_dispatch () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#33 0x00007ffff0aadfd7 in g_main_context_iterate_unlocked.isra () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#34 0x00007ffff0aae88f in g_main_loop_run () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#35 0x00007ffff1206b35 in gtk_main () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#36 0x00000000005c74d9 in main_gtk_thread (data=data@entry=0x0) at /nix/store/2pwh4vl9h00kina3vwxykrjgwja1j95h-source/src/tray/unix/SDL_tray.c:131
#37 0x0000000000586bca in SDL_RunThread (thread=0x13dfe90) at /nix/store/2pwh4vl9h00kina3vwxykrjgwja1j95h-source/src/thread/SDL_thread.c:328
#38 0x00000000005d550f in RunThread (data=<optimized out>) at /nix/store/2pwh4vl9h00kina3vwxykrjgwja1j95h-source/src/thread/pthread/SDL_systhread.c:73
#39 0x00007ffff74a1272 in start_thread () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#40 0x00007ffff751cdec in clone3 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
@slouken slouken added this to the 3.2.0 milestone Jan 16, 2025
@slouken
Copy link
Collaborator

slouken commented Jan 16, 2025

@Semphriss, can you take a look?

@Semphriss
Copy link
Contributor

@Green-Sky Can you send a minimal reproducible code sample and specify when and how consistently the crash happens?

Since the crash happens in gtk_main, it's more difficult to guess which part of the code causes the crash. I did read that GTK functions, although they can be called from any thread, must be called from the same thread. That isn't the case currently, so I'll add myself the task of making it all happen in one thread.

@slouken
Copy link
Collaborator

slouken commented Jan 16, 2025

@Green-Sky Can you send a minimal reproducible code sample and specify when and how consistently the crash happens?

Since the crash happens in gtk_main, it's more difficult to guess which part of the code causes the crash. I did read that GTK functions, although they can be called from any thread, must be called from the same thread. That isn't the case currently, so I'll add myself the task of making it all happen in one thread.

Yes, you'll definitely have to do that.

@slouken
Copy link
Collaborator

slouken commented Jan 16, 2025

By the way, we're planning a release candidate build in the next few days, so if you can get to your tray bugs soon that would be great.

@Green-Sky
Copy link
Contributor Author

Green-Sky commented Jan 18, 2025

Got another.

Can you send a minimal reproducible code sample and specify when and how consistently the crash happens?

Rare, sometimes minutes, sometimes days after the application is started. I don't really do much, the only thing that is set pretty often is the icon. Everything else is static (there are 2 buttons in the menu that are set once).

edit: This one is slightly different, so I'm adding it here:

Details
tomato: ../src/cairo-surface.c:938: cairo_surface_reference: Assertion `CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count)' failed.

Thread 2 "tray gtk" received signal SIGABRT, Aborted.
[Switching to LWP 1936180]
0x00007ffff74a2efc in __pthread_kill_implementation () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
(gdb) bt
#0  0x00007ffff74a2efc in __pthread_kill_implementation () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#1  0x00007ffff7452e86 in raise () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#2  0x00007ffff743b935 in abort () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#3  0x00007ffff743b859 in __assert_fail_base.cold () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#4  0x00007ffff744b6e6 in __assert_fail () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#5  0x00007ffff0e037ad in cairo_surface_reference () from /nix/store/ag0yl2kh55ab1n3jq9d3ha0z0qi8krm2-cairo-1.18.0/lib/libcairo.so.2
#6  0x00007ffff11cc70e in _gtk_icon_helper_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#7  0x00007ffff11e1002 in gtk_image_render_contents () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#8  0x00007ffff112dbbd in gtk_css_custom_gadget_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#9  0x00007ffff1133bff in gtk_css_gadget_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#10 0x00007ffff11e08f1 in gtk_image_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#11 0x00007ffff135d424 in gtk_widget_draw_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#12 0x00007ffff1127aa1 in gtk_container_propagate_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#13 0x00007ffff1127bac in gtk_container_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#14 0x00007ffff141344e in gtk_tray_icon_draw () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#15 0x00007ffff135d424 in gtk_widget_draw_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#16 0x00007ffff13668a8 in gtk_widget_render () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#17 0x00007ffff12079bf in gtk_main_do_event () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#18 0x00007ffff18ec745 in _gdk_event_emit () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#19 0x00007ffff18fb689 in _gdk_window_process_updates_recurse_helper () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#20 0x00007ffff18fd296 in gdk_window_process_updates_internal () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#21 0x00007ffff18fd497 in gdk_window_process_updates_with_mode () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#22 0x00007ffff1833861 in _g_closure_invoke_va () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#23 0x00007ffff184969c in signal_emit_valist_unlocked () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#24 0x00007ffff184f2c2 in g_signal_emit_valist () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#25 0x00007ffff184f36f in g_signal_emit () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libgobject-2.0.so.0
#26 0x00007ffff18f5a8f in gdk_frame_clock_paint_idle () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#27 0x00007ffff18e1b37 in gdk_threads_dispatch () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgdk-3.so.0
#28 0x00007ffff0aaec7a in g_timeout_dispatch () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#29 0x00007ffff0aaae39 in g_main_dispatch () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#30 0x00007ffff0aadfd7 in g_main_context_iterate_unlocked.isra () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#31 0x00007ffff0aae88f in g_main_loop_run () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#32 0x00007ffff1206b35 in gtk_main () from /nix/store/wky1jsp6g0vdn7i81g1s5yvha6fnadpr-gtk+3-3.24.42/lib/libgtk-3.so.0
#33 0x00000000005cb738 in main_gtk_thread (data=data@entry=0x0) at /nix/store/ypyyh34hziz6psvyb3z004dczv9x19ya-source/src/tray/unix/SDL_tray.c:133
#34 0x000000000058a4e1 in SDL_RunThread (thread=0x1fd2c00) at /nix/store/ypyyh34hziz6psvyb3z004dczv9x19ya-source/src/thread/SDL_thread.c:328
#35 0x00000000005d88fd in RunThread (data=<optimized out>) at /nix/store/ypyyh34hziz6psvyb3z004dczv9x19ya-source/src/thread/pthread/SDL_systhread.c:73
#36 0x00007ffff74a1272 in start_thread () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#37 0x00007ffff751cdec in clone3 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
(gdb) info threads
  Id   Target Id                    Frame
  1    LWP 1936176 "tomato"         0x00007ffff74e90c5 in clock_nanosleep@GLIBC_2.2.5 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
* 2    LWP 1936180 "tray gtk"       0x00007ffff74a2efc in __pthread_kill_implementation () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  3    LWP 1936181 "pool-spawner"   0x00007ffff751ad1d in syscall () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  4    LWP 1936182 "gmain"          0x00007ffff750f62f in poll () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  7    LWP 1936185 "gdbus"          0x00007ffff750f62f in poll () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  8    LWP 1936186 "tomato"         0x00007ffff74e90c5 in clock_nanosleep@GLIBC_2.2.5 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  9    LWP 1936187 "tray gtk"       0x00007ffff751ad1d in syscall () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  10   LWP 1936196 "pw-data-loop"   0x00007ffff751d206 in epoll_wait () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
  11   LWP 1936197 "SDLPwAudioPlug" 0x00007ffff751d206 in epoll_wait () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6

(gdb) thread apply 9 bt
Thread 9 (LWP 1936187 "tray gtk"):
#0  0x00007ffff751ad1d in syscall () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#1  0x00007ffff0b08d00 in g_cond_wait () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#2  0x00007ffff0a770bb in g_async_queue_pop_intern_unlocked () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#3  0x00007ffff0a77547 in g_async_queue_pop () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#4  0x00007ffff1e40203 in fc_thread_func () from /nix/store/wmllcch1shy9dg3wa8rpsjyx439p1dqx-pango-1.52.2/lib/libpangoft2-1.0.so.0
#5  0x00007ffff0adb3bd in g_thread_proxy () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#6  0x00007ffff74a1272 in start_thread () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#7  0x00007ffff751cdec in clone3 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6

(gdb) thread apply 4 bt
Thread 4 (LWP 1936182 "gmain"):
#0  0x00007ffff750f62f in poll () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#1  0x00007ffff0aadf2f in g_main_context_iterate_unlocked.isra () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#2  0x00007ffff0aae5cc in g_main_context_iteration () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#3  0x00007ffff0aae611 in glib_worker_main () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#4  0x00007ffff0adb3bd in g_thread_proxy () from /nix/store/yl0m9g65iv1wa6lrbbk959ag2ahw355b-glib-2.80.2/lib/libglib-2.0.so.0
#5  0x00007ffff74a1272 in start_thread () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#6  0x00007ffff751cdec in clone3 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6

@Semphriss
Copy link
Contributor

Is there some other activity (specifically, calling tray-related functions) happening while the crash happens, or is it just not doing anything and waiting? Also, do you use GTK3 elsewhere in your application?

@Green-Sky
Copy link
Contributor Author

Is there some other activity (specifically, calling tray-related functions) happening while the crash happens

The only thing that happens is set icon.

or is it just not doing anything and waiting? Also, do you use GTK3 elsewhere in your application?

No I don't use any GTK, besides the tray/whatever else SDL might be doing.

Set icon is called when there is a new unread message, and called again when there is no longer.

https://github.com/Green-Sky/tomato is the app.

It might be possible to trigger this by spamming set icon, if that is the bug.

@slouken slouken assigned slouken and unassigned Semphriss Jan 19, 2025
slouken added a commit to slouken/SDL that referenced this issue Jan 20, 2025
GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread.

Fixes libsdl-org#11984
slouken added a commit to slouken/SDL that referenced this issue Jan 20, 2025
GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread.

Fixes libsdl-org#11984
slouken added a commit to slouken/SDL that referenced this issue Jan 20, 2025
GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread.

Fixes libsdl-org#11984
slouken added a commit to slouken/SDL that referenced this issue Jan 20, 2025
GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread.

Fixes libsdl-org#11984
slouken added a commit to slouken/SDL that referenced this issue Jan 20, 2025
GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread.

Fixes libsdl-org#11984
@slouken
Copy link
Collaborator

slouken commented Jan 20, 2025

All tray operations happen on the main thread, so there should no longer be any race conditions in the tray code. Please let us know if you're still getting crashes in the latest main code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants