Summary:
This would cause debug builds to do a bad thing (access the variable `this->detached_` within an assert, after `delete this`).
Test Plan: unit tests
Hopefully now that we have a dummy cpp file in `folly/wangle/detail` contbuild
will pick it up and all the dependencies will also run their tests.
Right now, we suspect maybe maelstrom (@wez) and adinvoicer and zookeeper
(@jying) and probably others are seeing this in unit test failures (esp. if
they use asan, which is rightly detecting read after free). Hoping contbuild
will catch them.
Reviewed By: davejwatson@fb.com
Subscribers: net-systems@, fugalh, exa, njormrod, folly-diffs@, wez, dcapel, jying, cgheorghe
FB internal diff:
D1630301
Tasks:
5424546,
5435720
Blame Revision:
D1618240
}
void detachOne() {
- if (++detached_ == 2) {
+ ++detached_;
+ assert(detached_ == 1 || detached_ == 2);
+ if (detached_ == 2) {
// we should have already executed the callback with the value
assert(calledBack_);
delete this;
}
- assert(detached_ == 1 || detached_ == 2);
}
folly::Optional<Try<T>> result_;