Commit fd915b73 authored by Hans Fugal's avatar Hans Fugal Committed by dcsommer

(wangle) fix after-delete assert

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
parent 5aa44fb2
......@@ -205,12 +205,13 @@ class Core : protected FSM<State> {
}
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_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment