Skip to content

Commit 528e7a4

Browse files
Windsland52MistEO
andauthored
fix: 修复 StopTask 在 need_to_stop 时丢失 action 结果 (#1213)
## Summary by Sourcery Bug Fixes: - 即使在操作执行过程中触发 `need_to_stop`,也要保留并通知 StopTask 操作的结果。 <details> <summary>Original summary in English</summary> ## Summary by Sourcery Bug Fixes: - Preserve and notify the result of StopTask actions even when need_to_stop is triggered during action execution. </details> --------- Co-authored-by: MistEO <mistereo@hotmail.com>
1 parent 547de54 commit 528e7a4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

source/MaaFramework/Task/TaskBase.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,17 @@ ActionResult TaskBase::run_action(const RecoResult& reco, const PipelineData& da
137137
LogInfo << "action" << VAR(i) << VAR(data.repeat) << VAR(result);
138138

139139
if (context_->need_to_stop()) {
140-
return { };
140+
break;
141141
}
142142
}
143143

144144
cb_detail["action_details"] = result;
145145
notify(result.success ? MaaMsg_Node_Action_Succeeded : MaaMsg_Node_Action_Failed, cb_detail);
146146

147-
wait_freezes(data.post_wait_freezes, *reco.box, data.name);
148-
sleep(data.post_delay);
147+
if (!context_->need_to_stop()) {
148+
wait_freezes(data.post_wait_freezes, *reco.box, data.name);
149+
sleep(data.post_delay);
150+
}
149151

150152
return result;
151153
}

0 commit comments

Comments
 (0)