diff options
Diffstat (limited to 'include/grpcpp/impl/codegen/callback_common.h')
-rw-r--r-- | include/grpcpp/impl/codegen/callback_common.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/grpcpp/impl/codegen/callback_common.h b/include/grpcpp/impl/codegen/callback_common.h index eba9ec6edc..8273ef2f4a 100644 --- a/include/grpcpp/impl/codegen/callback_common.h +++ b/include/grpcpp/impl/codegen/callback_common.h @@ -101,10 +101,11 @@ class CallbackWithStatusTag GPR_CODEGEN_ASSERT(ignored == ops_); // Last use of func_ or status_, so ok to move them out - CatchingCallback(std::move(func_), std::move(status_)); - + auto func = std::move(func_); + auto status = std::move(status_); func_ = nullptr; // reset to clear this out for sure status_ = Status(); // reset to clear this out for sure + CatchingCallback(std::move(func), std::move(status)); g_core_codegen_interface->grpc_call_unref(call_); } }; @@ -124,6 +125,8 @@ class CallbackWithSuccessTag // there are no tests catching the compiler warning. static void operator delete(void*, void*) { assert(0); } + CallbackWithSuccessTag() : call_(nullptr), ops_(nullptr) {} + CallbackWithSuccessTag(grpc_call* call, std::function<void(bool)> f, CompletionQueueTag* ops) : call_(call), func_(std::move(f)), ops_(ops) { @@ -154,9 +157,9 @@ class CallbackWithSuccessTag GPR_CODEGEN_ASSERT(ignored == ops_); // Last use of func_, so ok to move it out for rvalue call above - CatchingCallback(std::move(func_), ok); - + auto func = std::move(func_); func_ = nullptr; // reset to clear this out for sure + CatchingCallback(std::move(func), ok); g_core_codegen_interface->grpc_call_unref(call_); } }; |