Skip to content

csm-manager.c: Prevent redundant re-entry and app restarts during shutdown - #221

Closed
DerLinke wants to merge 1 commit into
linuxmint:masterfrom
DerLinke:fix-shutdown-reentry-loop
Closed

DerLinke wants to merge 1 commit into
linuxmint:masterfrom
DerLinke:fix-shutdown-reentry-loop

Conversation

@DerLinke

Copy link
Copy Markdown

When the session enters CSM_MANAGER_PHASE_END_SESSION or CSM_MANAGER_PHASE_EXIT (particularly noticeable under Wayland sessions during logout or power off), client applications terminate upon receiving signals (SIGTERM / SIGHUP). Previously, app_died() and app_exited() would attempt to restart dying components, triggering redundant phase transitions and repeatedly calling csm_manager_quit().

Changes

  1. Adds an is_quitting flag in CsmManagerPrivate to ensure csm_manager_quit() executes only once.
  2. Skips component restarts in app_died() and app_exited() once the session is in END_SESSION / EXIT phase or is_quitting.
  3. Guards request_reboot(), request_shutdown(), and request_logout() against re-entry if a shutdown sequence is already in progress.
  4. Ensures systemduserunitdir defaults to prefix when prefix is not /usr.

…tdown

When the session enters CSM_MANAGER_PHASE_END_SESSION or CSM_MANAGER_PHASE_EXIT,
applications terminate from signals (SIGTERM/SIGHUP). Previously, app_died()
and app_exited() would attempt to restart dying components, triggering
redundant phase transitions and repeatedly calling csm_manager_quit().

This patch:
1. Adds an is_quitting guard in CsmManagerPrivate to ensure csm_manager_quit()
   is executed only once.
2. Skips app restarts in app_died() and app_exited() once the session is
   in END_SESSION/EXIT phase or is_quitting.
3. Guards request_reboot(), request_shutdown(), and request_logout() against
   re-entry if a shutdown sequence is already in progress.
4. Ensures systemduserunitdir installs into prefix when prefix is not /usr.
@mtwebster

Copy link
Copy Markdown
Member

2ab4059

@mtwebster mtwebster closed this Oct 15, 2026
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.

2 participants