From 2d699d82b826b6206eb4f5ac458e7bae51934be8 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Mon, 4 May 2026 21:00:54 +0200 Subject: [PATCH] fix crash on disable --- plugins/schedule/macro-schedule-tab.cpp | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/schedule/macro-schedule-tab.cpp b/plugins/schedule/macro-schedule-tab.cpp index 4bbabf9d..9aedefe0 100644 --- a/plugins/schedule/macro-schedule-tab.cpp +++ b/plugins/schedule/macro-schedule-tab.cpp @@ -624,19 +624,21 @@ void MacroScheduleTab::ToggleEnabled() } // If all selected entries are enabled, disable them; otherwise enable all. - auto lock = LockContext(); - bool allEnabled = true; - for (const auto &entry : GetScheduleEntries()) { - if (ids.contains(QString::fromStdString(entry.id)) && - !entry.enabled) { - allEnabled = false; - break; + { + auto lock = LockContext(); + bool allEnabled = true; + for (const auto &entry : GetScheduleEntries()) { + if (ids.contains(QString::fromStdString(entry.id)) && + !entry.enabled) { + allEnabled = false; + break; + } } - } - const bool newState = !allEnabled; - for (auto &entry : GetScheduleEntries()) { - if (ids.contains(QString::fromStdString(entry.id))) { - entry.enabled = newState; + const bool newState = !allEnabled; + for (auto &entry : GetScheduleEntries()) { + if (ids.contains(QString::fromStdString(entry.id))) { + entry.enabled = newState; + } } } Refresh();