Skip to content

Install SIGINT/SIGTERM handlers for clean shutdown - #53

Open
jEsuSdA wants to merge 1 commit into
tycho-kirchner:masterfrom
jEsuSdA:fix/signal-handlers-clean-shutdown
Open

Install SIGINT/SIGTERM handlers for clean shutdown#53
jEsuSdA wants to merge 1 commit into
tycho-kirchner:masterfrom
jEsuSdA:fix/signal-handlers-clean-shutdown

Conversation

@jEsuSdA

@jEsuSdA jEsuSdA commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Adds SIGINT/SIGTERM handlers so the compositor shuts down cleanly instead of leaving X resources unreleased.

Problem

Currently, fastcompmgr exits uncleanly when receiving SIGINT or SIGTERM, leaving X resources (pictures, regions) unreleased and the X connection open. This can cause leaks or leave the display in an inconsistent state if the compositor is restarted frequently.

Solution

  • Add signal_handler() that sets a volatile flag on SIGINT/SIGTERM
  • Install handlers in main() after X11 init
  • Check the flag in the event loop and break cleanly
  • On exit, free root_buffer, root_picture, root_tile, all_damage, g_xregion_tmp, and close the X display properly

Scope

  • Only fastcompmgr.c is touched
  • make clean && make produces zero warnings, zero errors

Impact

The compositor now releases its X resources and closes the display connection gracefully on normal termination signals. No functional change during normal operation.

Currently, fastcompmgr exits uncleanly when receiving SIGINT or SIGTERM,
leaving X resources (pictures, regions) unreleased and the X connection
open. This can cause leaks or leave the display in an inconsistent state
if the compositor is restarted frequently.

Changes:

- Add signal_handler() that sets a volatile flag on SIGINT/SIGTERM
- Install handlers in main() after X11 init
- Check the flag in the event loop and break cleanly
- On exit, free root_buffer, root_picture, root_tile, all_damage,
  g_xregion_tmp, and close the X display properly

This ensures the compositor releases its X resources and closes the
display connection gracefully on normal termination signals.
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.

1 participant