diff options
author | Ben Caimano <ben.caimano@10gen.com> | 2020-01-31 17:27:25 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-01-31 23:02:53 +0000 |
commit | f4f87e2b3f04172974b00eb1fb8666c787c05a12 (patch) | |
tree | 8fdadd10247283a1afc44f28b5394cf1d463d0b8 | |
parent | fc200fe8df4c2894b7a59c7b923eb6664996ac21 (diff) | |
download | mongo-f4f87e2b3f04172974b00eb1fb8666c787c05a12.tar.gz |
SERVER-45793 Improve mongo::Mutex contract
This additional commit fixes an ASAN failure.
-rw-r--r-- | src/mongo/platform/mutex.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/platform/mutex.h b/src/mongo/platform/mutex.h index 42e9c09a525..833a33560cf 100644 --- a/src/mongo/platform/mutex.h +++ b/src/mongo/platform/mutex.h @@ -192,7 +192,9 @@ TEMPLATE(typename ListenerT) REQUIRES(std::is_base_of_v<DiagnosticListener, ListenerT>) void installDiagnosticListener() { auto& state = getDiagnosticListenerState(); - state.listeners.push_back(new ListenerT()); + + static auto listener = ListenerT(); + state.listeners.push_back(&listener); invariant(!state.isFinalized.load()); } |