From 2a6eedbb51fd612d3386b0379938036b17511ae0 Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Tue, 7 Apr 2020 21:07:44 +0200 Subject: [PATCH] [clangd] Destroy context before resetting CurrentReq Summary: Our tests stash callbacks into request context and rely on it being invoked before threads going idle. Reviewers: sammccall Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77671 --- clang-tools-extra/clangd/TUScheduler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp index 46ec8e9..6b2d336 100644 --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -255,9 +255,11 @@ public: NextReq.reset(); } - WithContext Guard(std::move(CurrentReq->Ctx)); - // Build the preamble and let the waiters know about it. - build(std::move(*CurrentReq)); + { + WithContext Guard(std::move(CurrentReq->Ctx)); + // Build the preamble and let the waiters know about it. + build(std::move(*CurrentReq)); + } bool IsEmpty = false; { std::lock_guard Lock(Mutex); -- 2.7.4