From 1dc88fabf503cc5e99c73947fe794c4de03a64a8 Mon Sep 17 00:00:00 2001 From: Grigo Date: Tue, 10 Nov 2026 10:58:16 +0000 Subject: [PATCH] Fix UI freeze every 5 s The settings main page exists from startup inside the closed dialog and its IP timer always ran: networkInfo() spawns nmcli twice synchronously on the GUI thread (~200 ms), stalling every animation. Poll only while the page is visible. Also write the qt.alive heartbeat without QSaveFile's fsync (bt-update only checks its mtime). Co-Authored-By: Claude Opus 5.5 --- qml/settings/MainPage.qml | 7 ++++++- src/systeminfo.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/qml/settings/MainPage.qml b/qml/settings/MainPage.qml index 10b434c..afe80ff 100644 --- a/qml/settings/MainPage.qml +++ b/qml/settings/MainPage.qml @@ -42,9 +42,14 @@ Item { refreshIp() refreshBrightness() } + // networkInfo() runs nmcli synchronously on the GUI thread (~200 ms), so + // poll only while this page is on screen. The page exists from startup + // inside the closed settings dialog; an always-running timer froze all + // animations every 5 s. + onVisibleChanged: if (visible) refreshIp() Timer { interval: 5000 - running: true + running: page.visible repeat: true onTriggered: page.refreshIp() } diff --git a/src/systeminfo.cpp b/src/systeminfo.cpp index e335734..529d6cd 100644 --- a/src/systeminfo.cpp +++ b/src/systeminfo.cpp @@ -55,12 +55,13 @@ QString SystemInfo::scriptsDir() const void SystemInfo::writeHeartbeat() { - QSaveFile f(runDir() + "/qt.alive"); + // Runs on the GUI thread every 5 s. Plain write, no QSaveFile: its + // commit() fsyncs, which on eMMC can stall the UI for a visible moment. + // bt-update only looks at the mtime, so atomicity is not needed. + QFile f(runDir() + "/qt.alive"); if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) return; - QByteArray ts = QByteArray::number(QDateTime::currentSecsSinceEpoch()); - f.write(ts); - f.commit(); + f.write(QByteArray::number(QDateTime::currentSecsSinceEpoch())); } QString SystemInfo::appVersion() const