Skip to content

Commit 2b4f482

Browse files
committed
Fix not using correct settings for injected helpers
Fix yck1509#447
1 parent b561e20 commit 2b4f482

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

Confuser.Core/ObfAttrMarker.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ void ApplyInfo(IDnlibDef context, ProtectionSettings settings, IEnumerable<Prote
127127
}
128128
}
129129
}
130-
131-
public ProtectionSettings GetCurrentSettings() {
132-
return new ProtectionSettings(settings);
133-
}
134130
}
135131

136132
static readonly Regex OrderPattern = new Regex("^(\\d+)\\. (.+)$");
@@ -284,8 +280,9 @@ IEnumerable<ProtectionSettingsInfo> ReadInfos(IHasCustomAttribute item) {
284280
/// <inheritdoc />
285281
protected internal override void MarkMember(IDnlibDef member, ConfuserContext context) {
286282
ModuleDef module = ((IMemberRef)member).Module;
287-
var settings = context.Annotations.Get<ProtectionSettings>(module, ModuleSettingsKey);
288-
ProtectionParameters.SetParameters(context, member, new ProtectionSettings(settings));
283+
var stack = context.Annotations.Get<ProtectionSettingsStack>(module, ModuleSettingsKey);
284+
using (stack.Apply(member, Enumerable.Empty<ProtectionSettingsInfo>()))
285+
return;
289286
}
290287

291288
/// <inheritdoc />
@@ -431,7 +428,7 @@ void MarkModule(ProjectModule projModule, ModuleDefMD module, Rules rules, bool
431428
}
432429

433430
void ProcessModule(ModuleDefMD module, ProtectionSettingsStack stack) {
434-
context.Annotations.Set(module, ModuleSettingsKey, stack.GetCurrentSettings());
431+
context.Annotations.Set(module, ModuleSettingsKey, new ProtectionSettingsStack(stack));
435432
foreach (var type in module.Types) {
436433
using (stack.Apply(type, ReadInfos(type)))
437434
ProcessTypeMembers(type, stack);

0 commit comments

Comments
 (0)