diff options
Diffstat (limited to 'src/mongo/platform/mutex.h')
-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()); } |