From 7b16ce6770a009a606c56a79b6df4494eafb099b Mon Sep 17 00:00:00 2001 From: Tao He Date: Tue, 27 Apr 2021 22:23:43 +0800 Subject: [PATCH] Wait: wait without callback, otherwise there will be use-after-dtor. Signed-off-by: Tao He --- src/Watcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Watcher.cpp b/src/Watcher.cpp index 89b979c..e02c873 100644 --- a/src/Watcher.cpp +++ b/src/Watcher.cpp @@ -107,7 +107,7 @@ void etcd::Watcher::Wait(std::function callback) currentTask.then([this, callback](pplx::task const & resp_task) { resp_task.wait(); callback(this->stubs->call->Cancelled()); - }); + }).wait(); } void etcd::Watcher::Cancel()