Fix ASAN failure in FutureDAG test
authorAndrii Grynenko <andrii@fb.com>
Wed, 22 Nov 2017 04:58:05 +0000 (20:58 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 22 Nov 2017 05:20:04 +0000 (21:20 -0800)
Summary: dogscience

Reviewed By: yfeldblum

Differential Revision: D6387604

fbshipit-source-id: 3e33da3e3c6801d6e2186637c8fb6adaf1eef6f6

folly/experimental/FutureDAG.h

index 48d8dd2..ee3dcff 100644 (file)
@@ -134,10 +134,9 @@ class FutureDAG : public std::enable_shared_from_this<FutureDAG> {
     }
 
     nodes[sourceHandle].promise.setValue();
     }
 
     nodes[sourceHandle].promise.setValue();
-    auto that = shared_from_this();
-    return nodes[sinkHandle].promise.getFuture().ensure([that] {}).then(
-        [this, sourceHandle, sinkHandle]() {
-          clean_state(sourceHandle, sinkHandle);
+    return nodes[sinkHandle].promise.getFuture().then(
+        [that = shared_from_this(), sourceHandle, sinkHandle]() {
+          that->clean_state(sourceHandle, sinkHandle);
         });
   }
 
         });
   }