From 8b193d0a10b061c24c708336f5d834387c5cc920 Mon Sep 17 00:00:00 2001 From: leftydevkit <305883955+leftydevkit@users.noreply.github.com> Date: Thu, 10 Sep 2026 09:20:23 -0400 Subject: [PATCH] idle: clamp Timer intervals to avoid 32-bit overflow The idle screensaver and lock timers compute their interval as `seconds * 1000` into a 32-bit int property. secondsFromConfig() only validates finite and >= 0, so a large timeout (e.g. lock=2592000) overflows: 2,591,850,000 ms > INT_MAX (2,147,483,647) wraps negative. Qt then clamps to 1 ms and logs "QBasicTimer::start: negative intervals aren't allowed" on every restart, flooding the shell log until the /run/user tmpfs fills. Clamp both intervals to maxTimerIntervalMs (2^31 - 1). Fixes #11135 --- shell/plugins/services/idle/Service.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index 1453920d1240..3e9e2502f0bd 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -23,6 +23,8 @@ Item { readonly property int firstIdleTimeoutSeconds: Math.min(screensaverTimeoutSeconds, lockTimeoutSeconds) readonly property int screensaverDelaySeconds: Math.max(0, screensaverTimeoutSeconds - firstIdleTimeoutSeconds) readonly property int lockDelaySeconds: Math.max(0, lockTimeoutSeconds - firstIdleTimeoutSeconds) + // Timer.interval is a 32-bit int; clamp so a large timeout cannot wrap negative. + readonly property int maxTimerIntervalMs: 2147483647 readonly property bool idleEnabled: stayAwakeStateLoaded && !stayAwake readonly property string screensaverClass: "org.omarchy.screensaver" @@ -258,14 +260,14 @@ Item { Timer { id: screensaverTimer - interval: root.screensaverDelaySeconds * 1000 + interval: Math.min(root.screensaverDelaySeconds * 1000, root.maxTimerIntervalMs) repeat: false onTriggered: root.launchScreensaver() } Timer { id: lockTimer - interval: root.lockDelaySeconds * 1000 + interval: Math.min(root.lockDelaySeconds * 1000, root.maxTimerIntervalMs) repeat: false onTriggered: if (root.idleEnabled && root.idledThisCycle) root.lockSystem("lock-timeout") }