mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-18 13:59:46 +00:00
Fix reading from freed memory in rpl::take().
This commit is contained in:
@@ -406,6 +406,24 @@ TEST_CASE("basic operators tests", "[rpl::operators]") {
|
||||
*sum += "done";
|
||||
}, lifetime);
|
||||
}
|
||||
REQUIRE(*sum == "012done");
|
||||
{
|
||||
rpl::lifetime lifetime;
|
||||
rpl::ints(3) | take(3)
|
||||
| start_with_next_done([=](int value) {
|
||||
*sum += std::to_string(value);
|
||||
}, [=] {
|
||||
*sum += "done";
|
||||
}, lifetime);
|
||||
}
|
||||
{
|
||||
rpl::lifetime lifetime;
|
||||
rpl::ints(3) | take(10)
|
||||
| start_with_next_done([=](int value) {
|
||||
*sum += std::to_string(value);
|
||||
}, [=] {
|
||||
*sum += "done";
|
||||
}, lifetime);
|
||||
}
|
||||
REQUIRE(*sum == "012done012done012done");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user