blob: 79ad1e0bd18c8b631e9647b0c472645926e00ca7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
From 10f02e5641055b97eca8964dda85542885fa753b Mon Sep 17 00:00:00 2001
From: Konstantin Baladurin <k.baladurin@partner.samsung.com>
Date: Wed, 30 May 2018 19:34:11 +0300
Subject: [PATCH 32/47] Fix Use of EventPipeConfiguration After it has Been
Freed on Shutdown
Port #16704 for release/2.0.0
---
src/vm/eventpipe.cpp | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/vm/eventpipe.cpp b/src/vm/eventpipe.cpp
index 50909a1..5ef3ec7 100644
--- a/src/vm/eventpipe.cpp
+++ b/src/vm/eventpipe.cpp
@@ -91,18 +91,24 @@ void EventPipe::Shutdown()
}
CONTRACTL_END;
+ // Mark tracing as no longer initialized.
+ s_tracingInitialized = false;
+
Disable();
- if(s_pConfig != NULL)
- {
- delete(s_pConfig);
- s_pConfig = NULL;
- }
- if(s_pBufferManager != NULL)
- {
- delete(s_pBufferManager);
- s_pBufferManager = NULL;
- }
+ // Save pointers to the configuration and buffer manager.
+ EventPipeConfiguration *pConfig = s_pConfig;
+ EventPipeBufferManager *pBufferManager = s_pBufferManager;
+
+ // Set the static pointers to NULL so that the rest of the EventPipe knows that they are no longer available.
+ // Flush process write buffers to make sure other threads can see the change.
+ s_pConfig = NULL;
+ s_pBufferManager = NULL;
+ FlushProcessWriteBuffers();
+
+ // Free the configuration and buffer manager.
+ delete(pConfig);
+ delete(pBufferManager);
}
void EventPipe::Enable(
--
2.7.4
|