Clear props of type `ApiContainer` when clearing injected API props

This commit is contained in:
YoshiRulz 2023-01-08 08:27:31 +10:00
parent 3c00c24fcd
commit bc823f4795
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 6 additions and 1 deletions

View File

@ -17,7 +17,12 @@ namespace BizHawk.Client.Common
{
Type targetType = target.GetType();
object[] tmp = new object[1];
foreach (var mi in targetType.GetProperties(ReflectionExtensions.DI_TARGET_PROPS)
.Where(static pi => pi.PropertyType == typeof(ApiContainer))
.Select(static pi => pi.SetMethod))
{
mi?.Invoke(target, new object[] { null });
}
foreach (var propinfo in
targetType.GetPropertiesWithAttrib(typeof(RequiredApiAttribute))
.Concat(targetType.GetPropertiesWithAttrib(typeof(OptionalApiAttribute))))