Skip to content

Commit 5b24540

Browse files
committed
Added cleanup for allocated delegate handles.
1 parent cc9556f commit 5b24540

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Source/ExcelDna.Loader/XlRegistration.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ public static void RegisterDelegatesWithAttributes(List<Delegate> delegates, Lis
5757
targets.Add(del);
5858
}
5959
List<XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(methods, targets, null, methodAttributes, argumentAttributes);
60+
xlMethods.ForEach(i => delegateHandles.Add(i.DelegateHandle));
6061
RegisterXlMethods(xlMethods);
6162
}
6263

6364
public static void RegisterLambdaExpressionsWithAttributes(List<LambdaExpression> lambdaExpressions, List<object> methodAttributes, List<List<object>> argumentAttributes)
6465
{
6566
List<XlMethodInfo> xlMethods = XlMethodInfo.ConvertToXlMethodInfos(null, null, lambdaExpressions, methodAttributes, argumentAttributes);
67+
xlMethods.ForEach(i => delegateHandles.Add(i.DelegateHandle));
6668
RegisterXlMethods(xlMethods);
6769
}
6870

@@ -87,6 +89,7 @@ public static void RegisterRtdWrapper(string progId, object rtdWrapperOptions, o
8789
null,
8890
new List<object> { functionAttribute },
8991
new List<List<object>> { argumentAttributes });
92+
xlMethods.ForEach(i => delegateHandles.Add(i.DelegateHandle));
9093
RegisterXlMethods(xlMethods);
9194
}
9295

0 commit comments

Comments
 (0)