refactor(lsposed): mStackedLinks rewrite only on actual changes

The else-branch in sanitizeLinkProperties' stacked-links loop set
`modified = true` whenever `stackedCopy !== value`, i.e. after any
successful clone. Cloning is the common case (the catch fallback is
just a defensive shim for a missing copy ctor), so the flag was
effectively always-true: every non-empty stacked map triggered the
trailing `stacked.clear() + putAll(filtered)`, even when no VPN data
was present and no modification happened.

Drop the `stackedCopy !== value` disjunct. `modified` now reflects
only real sanitization changes — the rewrite is skipped when there's
nothing to write back, and the clones in `filtered` are discarded
along with the never-mutated original entries staying in place. No
behavioural change for VPN-stripping callers; just less wasted work
on the non-VPN-bearing path.
This commit is contained in:
okhsunrog 2026-04-26 15:47:12 +03:00
parent b9eacc63bc
commit d7ef5c7b8f

View file

@ -125,7 +125,13 @@ class HookEntry : IXposedHookLoadPackage {
filtered[key] = stackedCopy
}
} else {
if (stackedModified || stackedCopy !== value) modified = true
// Only mark `modified` if sanitization actually
// changed something. The previous condition also
// tripped on `stackedCopy !== value`, which is
// true after every successful clone — so any
// non-empty stacked map forced a clear+putAll
// even when no VPN data was present.
if (stackedModified) modified = true
filtered[key] = stackedCopy
}
}