Fix Wayland internal UI lifecycle edge cases

This commit is contained in:
hjozwiak committed 2026-11-11 09:05:10 -05:00
1 parent fc25f7e7e8
commit ac7f7acc43
12 files changed
+477 -90

No files matched your search

+16 -1
View File
@@ -291,7 +291,22 @@ func (owner *keyboardOwner) handle_key(key keyEvent) error {
// Capture exclusively before reporting the command, as on Xorg.
// An unavailable modal grab is a failed command, not a failed
// reader: session zero makes dispatch announce unavailability.
if session, err := owner.begin_internal_ui(owner.ctx); err == nil {
// Do not hold the secure mutex across compositor IPC; a secure
// transition during the calls retires the just-created session
// instead of reporting a command from before the lock.
generation := owner.generation
keyboard.secureMutex.Unlock()
session, err := owner.begin_internal_ui(owner.ctx)
keyboard.secureMutex.Lock()
if err == nil {
if generation != keyboard.secureGeneration.Load() {
owner.retire_secure_generation()
return nil
}
if !keyboard.enabled.Load() {
owner.dismiss_internal_ui()
return nil
}
uiSession = session
}
}