From 48d3c2a2491ad330aeae6f0b2dbaf2b9c96701ef Mon Sep 17 00:00:00 2001 From: Sung Yoon Whang Date: Fri, 31 May 2019 17:17:12 -0700 Subject: [PATCH] Move EventPipeEventSource deletion to a better place (dotnet/coreclr#24901) * Move EventPipeEventSource deletion to a better place * typo Commit migrated from https://github.com/dotnet/coreclr/commit/6d783b29087b5f260c9a64f347867bf6f6391bfe --- src/coreclr/src/vm/eventpipe.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/vm/eventpipe.cpp b/src/coreclr/src/vm/eventpipe.cpp index dea3b1e493c..0458be88544 100644 --- a/src/coreclr/src/vm/eventpipe.cpp +++ b/src/coreclr/src/vm/eventpipe.cpp @@ -259,6 +259,11 @@ void EventPipe::Shutdown() EX_CATCH {} EX_END_CATCH(SwallowAllExceptions); + // Remove EventPipeEventSource first since it tries to use the data structures that we remove below. + // We need to do this after disabling sessions since those try to write to EventPipeEventSource. + delete s_pEventSource; + s_pEventSource = nullptr; + EventPipeConfiguration *pConfig = s_pConfig; EventPipeSessions *pSessions = s_pSessions; @@ -271,8 +276,6 @@ void EventPipe::Shutdown() // Free resources. delete pConfig; delete pSessions; - delete s_pEventSource; - s_pEventSource = nullptr; } EventPipeSessionID EventPipe::Enable( -- GitLab