Skip to content

Commit 1f8537d

Browse files
committed
release CommandBarButton ctrl argument
1 parent 0aabcad commit 1f8537d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

RetailCoder.VBE/Extension.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,15 @@ private void Startup()
212212

213213
_app = _kernel.Get<App>();
214214
_app.Startup();
215+
215216
_isInitialized = true;
216217
}
217218

218219
private void ShutdownAddIn()
219220
{
221+
var currentDomain = AppDomain.CurrentDomain;
222+
currentDomain.AssemblyResolve -= LoadFromSameFolder;
223+
220224
User32.EnumChildWindows(_ide.MainWindow.Handle(), EnumCallback, new IntPtr(0));
221225

222226
if (_app != null)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ private void Target_Click(Microsoft.Office.Core.CommandBarButton ctrl, ref bool
5151
//note: event is fired for every parent the command exists under. not sure why.
5252
//System.Diagnostics.Debug.WriteLine("Target_Click: {0} '{1}' (tag: {2}, hashcode:{3})", Parent.Name, Target.Caption, Tag, Target.GetHashCode());
5353

54-
var args = new CommandBarButtonClickEventArgs(new CommandBarButton(ctrl));
54+
var button = new CommandBarButton(ctrl);
55+
var args = new CommandBarButtonClickEventArgs(button);
5556
handler.Invoke(this, args);
5657
cancelDefault = args.Cancel;
58+
button.Release(final:true);
5759
}
5860

5961
public bool IsBuiltInFace

0 commit comments

Comments
 (0)