Skip to content

Commit b3ff92f

Browse files
committed
Ensure thread safety for _lastExplorerView in NavigateDialogPath method
1 parent 6484ec0 commit b3ff92f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Flow.Launcher.Infrastructure/QuickSwitch/QuickSwitch.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,15 @@ private static void NavigateDialogPath(Action action = null)
163163
object document = null;
164164
try
165165
{
166-
if (_lastExplorerView != null)
166+
lock (_lastExplorerViewLock)
167167
{
168-
// Use dynamic here because using IWebBrower2.Document can cause exception here:
169-
// System.Runtime.InteropServices.InvalidOleVariantTypeException: 'Specified OLE variant is invalid.'
170-
dynamic explorerView = _lastExplorerView;
171-
document = explorerView.Document;
168+
if (_lastExplorerView != null)
169+
{
170+
// Use dynamic here because using IWebBrower2.Document can cause exception here:
171+
// System.Runtime.InteropServices.InvalidOleVariantTypeException: 'Specified OLE variant is invalid.'
172+
dynamic explorerView = _lastExplorerView;
173+
document = explorerView.Document;
174+
}
172175
}
173176
}
174177
catch (COMException)

0 commit comments

Comments
 (0)