Skip to content

Commit c9fde5a

Browse files
committed
removed (commented-out) menus and commandbars dispose/teardown... and against all recommendations, best practices, and common sense, ...we get a clean exit.
1 parent 34b2ca0 commit c9fde5a

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

RetailCoder.VBE/AppMenu.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ public void Localize()
4242

4343
public void Dispose()
4444
{
45-
foreach (var menu in _menus.Where(menu => menu.Item != null))
46-
{
47-
menu.RemoveChildren();
48-
menu.Item.Delete();
49-
}
45+
// note: doing this wrecks the teardown process. counter-intuitive? sure. but hey it works.
46+
//foreach (var menu in _menus.Where(menu => menu.Item != null))
47+
//{
48+
// menu.RemoveChildren();
49+
// menu.Item.Delete();
50+
//}
5051
}
5152
}
5253
}

RetailCoder.VBE/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,13 @@ public void EvaluateCanExecute(RubberduckParserState state)
110110
public ICommandBar Item { get; private set; }
111111
public void RemoveChildren()
112112
{
113-
foreach (var child in _items.Values.Select(item => item as CommandBarButton).Where(child => child != null))
114-
{
115-
child.Click -= child_Click;
116-
child.Delete();
117-
//child.Release();
118-
}
113+
// note: doing this wrecks the teardown process. counter-intuitive? sure. but hey it works.
114+
//foreach (var child in _items.Values.Select(item => item as CommandBarButton).Where(child => child != null))
115+
//{
116+
// child.Click -= child_Click;
117+
// child.Delete();
118+
// child.Release();
119+
//}
119120
}
120121

121122
// note: HAAAAACK!!!

RetailCoder.VBE/UI/Command/MenuItems/CommandBars/RubberduckCommandBar.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ public void SetContextSelectionCaption(string caption)
5353

5454
public void Dispose()
5555
{
56-
RemoveChildren();
57-
Item.Delete();
58-
Item.Release(true);
56+
//note: doing this wrecks the teardown process. counter-intuitive? sure. but hey it works.
57+
//RemoveChildren();
58+
//Item.Delete();
59+
//Item.Release(true);
5960
}
6061
}
6162

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ public void RemoveChildren()
9696
foreach (var child in _items.Keys.Select(item => item as IParentMenuItem).Where(child => child != null))
9797
{
9898
child.RemoveChildren();
99-
var item = _items[child];
100-
Debug.Assert(item is CommandBarPopup);
101-
(item as CommandBarPopup).Delete();
99+
//var item = _items[child];
100+
//Debug.Assert(item is CommandBarPopup);
101+
//(item as CommandBarPopup).Delete();
102102
}
103103
foreach (var child in _items.Values.Select(item => item as CommandBarButton).Where(child => child != null))
104104
{
105105
child.Click -= child_Click;
106-
child.Delete();
106+
//child.Delete();
107107
}
108108
}
109109

Rubberduck.VBEEditor/SafeComWrappers/Office.Core/CommandBars.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ public ICommandBar this[object index]
7777

7878
public override void Release(bool final = false)
7979
{
80-
if (!IsWrappingNullReference)
81-
{
82-
var commandBars = this.ToArray();
83-
foreach (var commandBar in commandBars)
84-
{
85-
commandBar.Release();
86-
}
87-
base.Release(final);
88-
}
80+
//if (!IsWrappingNullReference)
81+
//{
82+
// var commandBars = this.ToArray();
83+
// foreach (var commandBar in commandBars)
84+
// {
85+
// commandBar.Release();
86+
// }
87+
// base.Release(final);
88+
//}
8989
}
9090

9191
public override bool Equals(ISafeComWrapper<Microsoft.Office.Core.CommandBars> other)

Rubberduck.VBEEditor/SafeComWrappers/VBA/VBE.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public override void Release(bool final = false)
9090
{
9191
VBProjects.Release();
9292
CodePanes.Release();
93-
CommandBars.Release();
93+
//CommandBars.Release();
9494
Windows.Release();
9595
AddIns.Release();
9696
base.Release(final);

0 commit comments

Comments
 (0)