Skip to content

Commit

Permalink
Fix: Fixed COMException when removing focus from the path bar (files-…
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Jan 5, 2024
1 parent 71742c3 commit cebdba5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Files.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(()
/// </summary>
private void Window_Activated(object sender, WindowActivatedEventArgs args)
{
AppModel.IsMainWindowClosed = false;

// TODO(s): Is this code still needed?
if (args.WindowActivationState != WindowActivationState.CodeActivated ||
args.WindowActivationState != WindowActivationState.PointerActivated)
Expand Down
3 changes: 3 additions & 0 deletions src/Files.App/UserControls/AddressToolbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ private void VisiblePath_KeyDown(object _, KeyRoutedEventArgs e)
}
private void VisiblePath_LostFocus(object _, RoutedEventArgs e)
{
if (App.AppModel.IsMainWindowClosed)
return;

var element = FocusManager.GetFocusedElement(MainWindow.Instance.Content.XamlRoot);
if (element is FlyoutBase or AppBarButton or Popup)
return;
Expand Down

0 comments on commit cebdba5

Please sign in to comment.