From b5842d4f53d3aa06d4e07b86706da403b3d7ae2f Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 4 Jul 2026 03:09:20 +0200 Subject: [PATCH] fix(core): don't floor an explicit interval:0 to 1ms std::max(1L, interval*1000) turned a user's explicit "interval": 0 into a 1ms periodic refresh, i.e. a ~1000x/s busy loop that starves the GTK main loop and leaks memory (mpris RSS growth, missing tooltips, frozen updates). An explicit 0 now stays the 'no periodic refresh' sentinel. Fixes #4987, #4842; helps #4864, #4917, #4998, #5145. --- src/ALabel.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ALabel.cpp b/src/ALabel.cpp index f7a98329..5db03457 100644 --- a/src/ALabel.cpp +++ b/src/ALabel.cpp @@ -25,8 +25,14 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st ? std::chrono::milliseconds::max() : std::chrono::milliseconds( (config_["interval"].isNumeric() - ? std::max(1L, // Minimum 1ms due to millisecond precision - static_cast(config_["interval"].asDouble() * 1000)) + ? (config_["interval"].asDouble() > 0 + // Minimum 1ms due to millisecond precision + ? std::max(1L, static_cast( + config_["interval"].asDouble() * 1000)) + // An explicit interval of 0 means "no periodic refresh" + // (event-driven only). Flooring it to 1ms busy-loops the + // main thread; keep it as the 0 sentinel (see custom.cpp). + : 0L) : 1000 * (long)interval))), default_format_(format_) { label_.set_name(name);