Browse Source

fix disposing native menus / events

Dan Walmsley 5 years ago
parent
commit
1bbea47c65
2 changed files with 3 additions and 0 deletions
  1. 1 0
      samples/ControlCatalog/MainWindow.xaml.cs
  2. 2 0
      src/Avalonia.Native/IAvnMenu.cs

+ 1 - 0
samples/ControlCatalog/MainWindow.xaml.cs

@@ -34,6 +34,7 @@ namespace ControlCatalog
             
             fileMenu.NeedsUpdate += (sender, e)=>
             {
+                fileMenu.Items.Clear();
                 fileMenu.Items.Add(new NativeMenuItem("Test 1"));
             };
 

+ 2 - 0
src/Avalonia.Native/IAvnMenu.cs

@@ -47,6 +47,8 @@ namespace Avalonia.Native.Interop
 
             events.Initialise(menu);
 
+            menu._events = events;
+
             return menu;
         }