@@ -23,9 +23,15 @@ public class UnityMixedCallstackFilter : IDkmCallStackFilter, IDkmLoadCompleteNo
2323
2424 public void OnLoadComplete ( DkmProcess process , DkmWorkList workList , DkmEventDescriptor eventDescriptor )
2525 {
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+ }
2935
3036 var env = Environment . GetEnvironmentVariable ( "UNITY_MIXED_CALLSTACK" ) ;
3137 if ( env == null || env == "0" ) // plugin not enabled
@@ -89,7 +95,13 @@ private static int GetFileNameSequenceNum(string path)
8995 private static void DisposeStreams ( )
9096 {
9197 _fileStreamReader ? . Dispose ( ) ;
98+ _fileStreamReader = null ;
99+
92100 _fileStream ? . Dispose ( ) ;
101+ _fileStream = null ;
102+
103+ _currentFile = null ;
104+
93105 _rangesSortedByIp . Clear ( ) ;
94106 }
95107
@@ -126,9 +138,9 @@ private static void RefreshStackData(int pid)
126138 }
127139 catch ( Exception ex )
128140 {
129- _currentFile = null ;
130141 _debugPane . OutputString ( "Unable to read dumped pmip file: " + ex . Message + "\n " ) ;
131142 DisposeStreams ( ) ;
143+ _enabled = false ;
132144 return ;
133145 }
134146 }
@@ -157,6 +169,9 @@ private static void RefreshStackData(int pid)
157169 catch ( Exception ex )
158170 {
159171 _debugPane . OutputString ( "Unable to read dumped pmip file: " + ex . Message + "\n " ) ;
172+ DisposeStreams ( ) ;
173+ _enabled = false ;
174+ return ;
160175 }
161176
162177 _rangesSortedByIp . Sort ( ( r1 , r2 ) => r1 . Start . CompareTo ( r2 . Start ) ) ;
0 commit comments