coolconvert: fix stack-use-after-scope

The vector is allocated on the stack in a for loop, so it's not valid to
refer to its address in the lambda that is executed on a thread. Rather
copy it.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ie1f85d6efb27a4aa44b181f8d9f134e9fa41d508
pull/3689/head
Miklos Vajna 2021-11-19 10:59:34 +01:00 committed by Andras Timar
parent 5ffcd450a8
commit dcfe16eec1
1 changed files with 1 additions and 1 deletions

View File

@ -260,7 +260,7 @@ int Tool::main(const std::vector<std::string>& origArgs)
std::vector< std::string > files( toCopy );
std::copy( args.begin() + offset, args.begin() + offset + toCopy, files.begin() );
offset += toCopy;
clients.emplace_back([this, &files]{Worker(*this, files).run();});
clients.emplace_back([this, files]{Worker(*this, files).run();});
}
}