mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-25 20:34:59 +00:00
fix: avoid NRE in ContextMenuExtension
This commit is contained in:
parent
3af30f54b6
commit
1914a3cab2
1 changed files with 5 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
|
||||||
namespace SourceGit.Views
|
namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,10 @@ namespace SourceGit.Views
|
||||||
menu.Closing += OnContextMenuClosing; // Clear context menu because it is dynamic.
|
menu.Closing += OnContextMenuClosing; // Clear context menu because it is dynamic.
|
||||||
|
|
||||||
control.ContextMenu = menu;
|
control.ContextMenu = menu;
|
||||||
control.ContextMenu.Open();
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
control.ContextMenu?.Open();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnContextMenuClosing(object sender, CancelEventArgs e)
|
private static void OnContextMenuClosing(object sender, CancelEventArgs e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue