Skip to content

Commit

Permalink
src: use BaseObjectPtr for keeping channel alive in dns bindings
Browse files Browse the repository at this point in the history
Backport-PR-URL: #32301
PR-URL: #30374
Refs: nodejs/quic#141
Refs: nodejs/quic#149
Refs: nodejs/quic#141
Refs: nodejs/quic#165
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
  • Loading branch information
addaleax authored and MylesBorins committed Apr 1, 2020
1 parent 4745ac4 commit 6db84d3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/cares_wrap.cc
Expand Up @@ -575,10 +575,6 @@ class QueryWrap : public AsyncWrap {
: AsyncWrap(channel->env(), req_wrap_obj, AsyncWrap::PROVIDER_QUERYWRAP),
channel_(channel),
trace_name_(name) {
// Make sure the channel object stays alive during the query lifetime.
req_wrap_obj->Set(env()->context(),
env()->channel_string(),
channel->object()).Check();
}

~QueryWrap() override {
Expand Down Expand Up @@ -735,7 +731,7 @@ class QueryWrap : public AsyncWrap {
UNREACHABLE();
}

ChannelWrap* channel_;
BaseObjectPtr<ChannelWrap> channel_;

private:
std::unique_ptr<ResponseData> response_data_;
Expand Down

0 comments on commit 6db84d3

Please sign in to comment.