Skip to content

Conversation

@Rtur2003
Copy link

@Rtur2003 Rtur2003 commented Dec 9, 2025

Summary

  • Added handling for cairo_pattern_status failures in render_sni; on OOM or pattern creation errors, the function now returns early with clear, actionable logs.
  • Guarded hotspot and ID allocations to prevent registration when the internal state is invalid.
  • Kept the successful (happy) path unchanged; safety improvements apply only to error paths.

Motivation

  • Prevent crashes and undefined behavior when Cairo fails to create a pattern or when heap allocations fail.
  • Ensure hotspots are not registered with an invalid or incomplete state, improving overall robustness.

Scope / Safety

  • Changes are limited to error-handling paths in swaybar/tray/item.c.
  • No behavior changes on the successful path; only early returns and logging were added.
  • No external dependencies introduced and no behavioral regressions expected.

Testing

  • Tests not run (per instructions).
  • Suggested verification if needed:
    • meson setup build && ninja -C build
    • Run swaybar with tray icons
    • Simulate low-memory conditions to exercise error paths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant