Destroy pointer args when destructing a ChannelArguments

pull/9889/head
Yuchen Zeng 8 years ago
parent 07e4c13a68
commit 77532e8bf3
  1. 2
      include/grpc++/support/channel_arguments.h
  2. 10
      src/cpp/common/channel_arguments.cc

@ -54,7 +54,7 @@ class ResourceQuota;
class ChannelArguments {
public:
ChannelArguments();
~ChannelArguments() {}
~ChannelArguments();
ChannelArguments(const ChannelArguments& other);
ChannelArguments& operator=(ChannelArguments other) {

@ -81,6 +81,16 @@ ChannelArguments::ChannelArguments(const ChannelArguments& other)
}
}
ChannelArguments::~ChannelArguments() {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
for (auto it = args_.begin(); it != args_.end(); ++it) {
if (it->type == GRPC_ARG_POINTER) {
it->value.pointer.vtable->destroy(&exec_ctx, it->value.pointer.p);
}
}
grpc_exec_ctx_finish(&exec_ctx);
}
void ChannelArguments::Swap(ChannelArguments& other) {
args_.swap(other.args_);
strings_.swap(other.strings_);

Loading…
Cancel
Save