Skip to content

Commit 6159f58

Browse files
committed
Correctly tear down menus.
1 parent 3aab7b5 commit 6159f58

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/ParentMenuItemBase.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Rubberduck.UI.Command.MenuItems.ParentMenus
1313
{
14-
public abstract class ParentMenuItemBase : IParentMenuItem
14+
public abstract class ParentMenuItemBase : IParentMenuItem, IDisposable
1515
{
1616
private readonly string _key;
1717
private readonly int? _beforeIndex;
@@ -190,5 +190,15 @@ static public Image PictureDispToImage(IPictureDisp pictureDisp)
190190
return GetPictureFromIPicture(pictureDisp);
191191
}
192192
}
193+
194+
public void Dispose()
195+
{
196+
foreach (var item in _items)
197+
{
198+
item.Value.Delete();
199+
}
200+
201+
Item.Delete();
202+
}
193203
}
194204
}

0 commit comments

Comments
 (0)