Skip to content

Commit 73795b3

Browse files
committed
Added some calls to ThreadHelper.ThrowIfNotOnUIThread.
1 parent 71cd6f5 commit 73795b3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/GtmExtension/GtmListener.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ private void AppendToWindowTitle(string title)
159159

160160
public void VsTextViewCreated(IVsTextView textView)
161161
{
162+
ThreadHelper.ThrowIfNotOnUIThread();
162163
Initialize();
163164

164165
IWpfTextView wpfTextView = editor.GetWpfTextView(textView);
@@ -170,14 +171,17 @@ public void VsTextViewCreated(IVsTextView textView)
170171
}
171172
private void WpfTextView_GotAggregateFocus(object sender, EventArgs e)
172173
{
174+
ThreadHelper.ThrowIfNotOnUIThread();
173175
Update(GetFilePath((ITextView)sender));
174176
}
175177
private void WpfTextView_LayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
176178
{
179+
ThreadHelper.ThrowIfNotOnUIThread();
177180
Update(GetFilePath((ITextView)sender));
178181
}
179182
private void Caret_PositionChanged(object sender, CaretPositionChangedEventArgs e)
180183
{
184+
ThreadHelper.ThrowIfNotOnUIThread();
181185
Update(GetFilePath(e.TextView));
182186
}
183187
private void DocumentEvents_DocumentSaved(Document Document)
@@ -233,6 +237,8 @@ private void Initialize()
233237
}
234238
private void Update(string path, bool force = false)
235239
{
240+
ThreadHelper.ThrowIfNotOnUIThread();
241+
236242
var time = DateTime.Now;
237243
if (force ||
238244
time - lastUpdate >= updateInterval ||

0 commit comments

Comments
 (0)