From c32b56e9d8aba7f8f4bffdcf9d43ab2188d76177 Mon Sep 17 00:00:00 2001 From: noctuum <25441068+noctuum@users.noreply.github.com> Date: Wed, 16 Sep 2026 11:48:04 +0500 Subject: [PATCH] Do not reschedule a deleted scheduler item schedule.remove from the scheduled command deletes the item. --- src/rpc/command_scheduler.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rpc/command_scheduler.cc b/src/rpc/command_scheduler.cc index a3956f7a..16410046 100644 --- a/src/rpc/command_scheduler.cc +++ b/src/rpc/command_scheduler.cc @@ -61,14 +61,20 @@ CommandScheduler::call_item(value_type item) { // Remove the item before calling the command if it should be // removed. + std::string key = item->key(); + try { rpc::call_object(item->command()); } catch (torrent::input_error& e) { if (m_slotErrorMessage) - m_slotErrorMessage("Scheduled command failed: " + item->key() + ": " + e.what()); + m_slotErrorMessage("Scheduled command failed: " + key + ": " + e.what()); } + // The command is allowed to erase or replace this item, which deletes it. + if (std::find(begin(), end(), item) == end()) + return; + // Still schedule if we caught a torrrent::input_error? auto next = item->next_time_scheduled();