From 235fb4c082b0a8093892fc1149b84223701de1c4 Mon Sep 17 00:00:00 2001 From: Mirek Klimos Date: Wed, 29 Jun 2016 15:42:34 -0700 Subject: [PATCH] Fix FiberManager.RequestContext unit test Summary: with the added blocks, pointer to RequestContext needs to be captured by value, not reference Differential Revision: D3499921 fbshipit-source-id: 76ff22869228fbdd7ef1651cd2814550f6abc301 --- folly/fibers/test/FibersTest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/folly/fibers/test/FibersTest.cpp b/folly/fibers/test/FibersTest.cpp index a149c44b..e962145a 100644 --- a/folly/fibers/test/FibersTest.cpp +++ b/folly/fibers/test/FibersTest.cpp @@ -1270,7 +1270,7 @@ TEST(FiberManager, RequestContext) { { folly::RequestContextScopeGuard rctx; auto rcontext1 = folly::RequestContext::get(); - fm.addTask([&]() { + fm.addTask([&, rcontext1]() { EXPECT_EQ(rcontext1, folly::RequestContext::get()); baton1.wait( [&]() { EXPECT_EQ(rcontext1, folly::RequestContext::get()); }); @@ -1283,7 +1283,7 @@ TEST(FiberManager, RequestContext) { { folly::RequestContextScopeGuard rctx; auto rcontext2 = folly::RequestContext::get(); - fm.addTaskRemote([&]() { + fm.addTaskRemote([&, rcontext2]() { EXPECT_EQ(rcontext2, folly::RequestContext::get()); baton2.wait(); EXPECT_EQ(rcontext2, folly::RequestContext::get()); @@ -1294,14 +1294,14 @@ TEST(FiberManager, RequestContext) { folly::RequestContextScopeGuard rctx; auto rcontext3 = folly::RequestContext::get(); fm.addTaskFinally( - [&]() { + [&, rcontext3]() { EXPECT_EQ(rcontext3, folly::RequestContext::get()); baton3.wait(); EXPECT_EQ(rcontext3, folly::RequestContext::get()); return folly::Unit(); }, - [&](Try&& /* t */) { + [&, rcontext3](Try&& /* t */) { EXPECT_EQ(rcontext3, folly::RequestContext::get()); checkRun3 = true; }); -- 2.34.1