@@ -23,9 +23,15 @@ public class UnityMixedCallstackFilter : IDkmCallStackFilter, IDkmLoadCompleteNo
23
23
24
24
public void OnLoadComplete ( DkmProcess process , DkmWorkList workList , DkmEventDescriptor eventDescriptor )
25
25
{
26
- IVsOutputWindow outWindow = Package . GetGlobalService ( typeof ( SVsOutputWindow ) ) as IVsOutputWindow ;
27
- Guid debugPaneGuid = VSConstants . GUID_OutWindowDebugPane ;
28
- outWindow . GetPane ( ref debugPaneGuid , out _debugPane ) ;
26
+ _enabled = true ;
27
+ DisposeStreams ( ) ;
28
+
29
+ if ( _debugPane == null )
30
+ {
31
+ IVsOutputWindow outWindow = Package . GetGlobalService ( typeof ( SVsOutputWindow ) ) as IVsOutputWindow ;
32
+ Guid debugPaneGuid = VSConstants . GUID_OutWindowDebugPane ;
33
+ outWindow . GetPane ( ref debugPaneGuid , out _debugPane ) ;
34
+ }
29
35
30
36
var env = Environment . GetEnvironmentVariable ( "UNITY_MIXED_CALLSTACK" ) ;
31
37
if ( env == null || env == "0" ) // plugin not enabled
@@ -89,7 +95,13 @@ private static int GetFileNameSequenceNum(string path)
89
95
private static void DisposeStreams ( )
90
96
{
91
97
_fileStreamReader ? . Dispose ( ) ;
98
+ _fileStreamReader = null ;
99
+
92
100
_fileStream ? . Dispose ( ) ;
101
+ _fileStream = null ;
102
+
103
+ _currentFile = null ;
104
+
93
105
_rangesSortedByIp . Clear ( ) ;
94
106
}
95
107
@@ -126,9 +138,9 @@ private static void RefreshStackData(int pid)
126
138
}
127
139
catch ( Exception ex )
128
140
{
129
- _currentFile = null ;
130
141
_debugPane . OutputString ( "Unable to read dumped pmip file: " + ex . Message + "\n " ) ;
131
142
DisposeStreams ( ) ;
143
+ _enabled = false ;
132
144
return ;
133
145
}
134
146
}
@@ -157,6 +169,9 @@ private static void RefreshStackData(int pid)
157
169
catch ( Exception ex )
158
170
{
159
171
_debugPane . OutputString ( "Unable to read dumped pmip file: " + ex . Message + "\n " ) ;
172
+ DisposeStreams ( ) ;
173
+ _enabled = false ;
174
+ return ;
160
175
}
161
176
162
177
_rangesSortedByIp . Sort ( ( r1 , r2 ) => r1 . Start . CompareTo ( r2 . Start ) ) ;
0 commit comments