Skip to content

Conversation

@BurgessTG
Copy link

The cava backend emits signals from a worker thread, but GTK widget
operations must run on the main thread. This causes intermittent
SIGSEGV/SIGABRT crashes with stack traces through pixman_region32_union
and gtk_label_set_markup.

This wraps all GTK operations in onUpdate() and onSilence() with
Glib::signal_idle().connect_once() to safely dispatch them to the
main thread.

Additional improvements:

  • Cache style context to avoid repeated get_style_context() calls
  • Check has_class() before removing classes
  • Use early return pattern in onSilence()
  • Use cached format_silent_ instead of re-reading config

Tested on Arch Linux with 15fps cava visualization - stable with no crashes.

The cava backend emits signals from a worker thread, but GTK widget
operations must run on the main thread. This causes intermittent
SIGSEGV/SIGABRT crashes with stack traces through pixman_region32_union
and gtk_label_set_markup.

Wrap all GTK operations in onUpdate() and onSilence() with
Glib::signal_idle().connect_once() to safely dispatch them to the
main thread.

Additional improvements:
- Cache style context to avoid repeated get_style_context() calls
- Check has_class() before removing classes to avoid unnecessary ops
- Use early return pattern in onSilence() for clarity
- Use cached format_silent_ instead of re-reading config
@LukashonakV
Copy link
Contributor

LukashonakV commented Dec 4, 2025

@BurgessTG , why do you do the same work? See PR #4587

@BurgessTG
Copy link
Author

Tbh, I was adding cava and was experiencing crashes on my own behalf. Instead of looking for a fix or checking I found one pretty quick. Wanted to offer it out as different option 😄

@LukashonakV
Copy link
Contributor

@BurgessTG, thank you. I didn't realize in my PR with some enhancements dispatching was a part of backend.. where basically it should be the logic of the frontend. Original PR is fixed for now.
Please close you PR in order do not clutter the list of incoming PR.
Thank you a lot

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

Successfully merging this pull request may close these issues.

2 participants