mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
SQLServer: Do not capture stack variables by reference in lambdas
If you capture a stack variable by reference in a lamdba definition, and this lambda outlives the scope of the stack variable, this reference may point to garbage when the lambda is executed. Therefore capture as little as possible (typically only ``this``), and what is captured is captured by value
This commit is contained in:
parent
c07f91474d
commit
c5c7a9d198
2 changed files with 4 additions and 4 deletions
|
@ -60,7 +60,7 @@ void SQLStatement::execute()
|
|||
return;
|
||||
}
|
||||
|
||||
deferred_invoke([&] {
|
||||
deferred_invoke([this]() {
|
||||
auto maybe_error = parse();
|
||||
if (maybe_error.has_value()) {
|
||||
report_error(maybe_error.value());
|
||||
|
@ -107,7 +107,7 @@ void SQLStatement::next()
|
|||
if (m_index < m_result->results().size()) {
|
||||
auto& tuple = m_result->results()[m_index++];
|
||||
client_connection->async_next_result(statement_id(), tuple.to_string_vector());
|
||||
deferred_invoke([&] {
|
||||
deferred_invoke([this]() {
|
||||
next();
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue