1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-02 03:28:28 -04:00

core/wayland: fix fatal error handling when the socket becomes

unavailable
This commit is contained in:
bbedward
2026-07-04 10:52:52 -04:00
parent 518cc93276
commit 6e508d416d
+10 -4
View File
@@ -108,10 +108,7 @@ func (sc *SharedContext) eventDispatcher() {
if r := recover(); r != nil {
err := fmt.Errorf("FATAL: Wayland event dispatcher panic: %v", r)
log.Error(err)
select {
case sc.fatalError <- err:
default:
}
sc.signalFatal(err)
}
}()
@@ -141,6 +138,7 @@ func (sc *SharedContext) eventDispatcher() {
continue
case err != nil:
log.Errorf("Poll error: %v", err)
sc.signalFatal(fmt.Errorf("wayland poll error: %w", err))
return
}
@@ -161,6 +159,7 @@ func (sc *SharedContext) eventDispatcher() {
if consecutiveErrors >= maxConsecutiveErrors {
log.Errorf("Fatal: Wayland connection unrecoverable after %d attempts. Exiting dispatcher.", maxConsecutiveErrors)
sc.signalFatal(fmt.Errorf("wayland connection unrecoverable after %d dispatch failures: %w", maxConsecutiveErrors, err))
return
}
@@ -172,6 +171,13 @@ func (sc *SharedContext) eventDispatcher() {
}
}
func (sc *SharedContext) signalFatal(err error) {
select {
case sc.fatalError <- err:
default:
}
}
func (sc *SharedContext) drainCmdQueue() {
for {
select {