Merge pull request #53573 from amosbird/fix_53454

Proper destruction of task in ShellCommandSource
This commit is contained in:
Alexey Milovidov 2023-08-19 12:19:29 +03:00 committed by GitHub
commit c42c4046fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -349,7 +349,7 @@ namespace
{ {
for (auto && send_data_task : send_data_tasks) for (auto && send_data_task : send_data_tasks)
{ {
send_data_threads.emplace_back([task = std::move(send_data_task), this]() send_data_threads.emplace_back([task = std::move(send_data_task), this]() mutable
{ {
try try
{ {
@ -359,6 +359,10 @@ namespace
{ {
std::lock_guard lock(send_data_lock); std::lock_guard lock(send_data_lock);
exception_during_send_data = std::current_exception(); exception_during_send_data = std::current_exception();
/// task should be reset inside catch block or else it breaks d'tor
/// invariants such as in ~WriteBuffer.
task = {};
} }
}); });
} }