Skip to content

Commit

Permalink
RDEV-6978 Fix Crash when webview is not yet added to visual tree (#339)
Browse files Browse the repository at this point in the history
* RDEV-6978 Fix Crash with detaching of tab when proxy is enabled

Fix Crash with detaching of tab when proxy is enabled

* RDEV-6978 Added comment

Added comment

* RDEV-6978 Updated comment

Updated comment
  • Loading branch information
OS-sandeeppal authored May 27, 2024
1 parent a3ee1ba commit b54932e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PropertyGroup>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<Version>2.121.101</Version>
<Version>2.121.102</Version>
<Authors>OutSystems</Authors>
<Product>WebViewControl</Product>
<Copyright>Copyright © OutSystems 2023</Copyright>
Expand Down
3 changes: 2 additions & 1 deletion WebViewControl.Avalonia/WebView.Avalonia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ internal void InitializeBrowser(int initialWidth, int initialHeight) {
/// <paramref name="isSystemEvent">True if is a system focus event, or false if is a navigation</paramref>
/// </summary>
protected virtual bool OnSetFocus(bool isSystemEvent) {
var focusedElement = TopLevel.GetTopLevel(this).FocusManager.GetFocusedElement();
// VisualRoot can be null when webview is not yet added to the Visual tree
var focusedElement = TopLevel.GetTopLevel(this)?.FocusManager.GetFocusedElement();
return !(focusedElement == chromium || focusedElement == this);
}
}
Expand Down

0 comments on commit b54932e

Please sign in to comment.