Merge pull request #16733 from vjpai/generic_lifetime

Confirm that generic API method name is not needed after call creation
pull/20092/head
Vijay Pai 5 years ago committed by GitHub
commit c22afac623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      test/cpp/end2end/generic_end2end_test.cc

@ -130,8 +130,16 @@ class GenericEnd2endTest : public ::testing::Test {
cli_ctx.set_deadline(deadline);
}
// Rather than using the original kMethodName, make a short-lived
// copy to also confirm that we don't refer to this object beyond
// the initial call preparation
const grpc::string* method_name = new grpc::string(kMethodName);
std::unique_ptr<GenericClientAsyncReaderWriter> call =
generic_stub_->PrepareCall(&cli_ctx, kMethodName, &cli_cq_);
generic_stub_->PrepareCall(&cli_ctx, *method_name, &cli_cq_);
delete method_name; // Make sure that this is not needed after invocation
call->StartCall(tag(1));
client_ok(1);
std::unique_ptr<ByteBuffer> send_buffer =

Loading…
Cancel
Save