Fix test variable scope

These variables need to persist past the end of the lambda and weren't;
release builds didn't seem to mind access the freed memory, but Debug
builds triggered failures.
pull/1306/head
Jason Rhinelander 4 years ago committed by Jeff Becker
parent 3dff5931a2
commit 271ded7a1f
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -239,14 +239,14 @@ TEST_CASE("IWP handshake reverse", "[iwp]")
/// ensure iwp can send messages between sessions
TEST_CASE("IWP send messages", "[iwp]")
{
RunIWPTest([](std::function<Logic_ptr(void)> start,
int aliceNumSent = 0;
int bobNumSent = 0;
RunIWPTest([&aliceNumSent, &bobNumSent](std::function<Logic_ptr(void)> start,
std::function<void(void)> endIfDone,
std::function<void(void)> endTestNow,
Context_ptr alice,
Context_ptr bob) {
constexpr int numSend = 128;
int aliceNumSent = 0;
int bobNumSent = 0;
// when alice makes a session to bob send `aliceNumSend` messages to him
alice->InitLink<false>([endIfDone, alice, &aliceNumSent](auto session) {
for (auto index = 0; index < numSend; index++)

Loading…
Cancel
Save