Fix hookAllMethods/hookedAllConstructors unhook problem

This commit is contained in:
2022-07-28 03:47:30 +08:00
parent 25c2c313dc
commit eac27cf36a

View File

@@ -659,12 +659,16 @@ object YukiHookBridge {
/** 解除 Hook */ /** 解除 Hook */
internal fun unhook() { internal fun unhook() {
instance.unhook() if (tag.isNotBlank()) runCatching {
runCatching { if (hookedAllMethods.contains(tag))
if (tag.isNotBlank()) { hookedAllMethods[tag]?.takeIf { it.isNotEmpty() }?.forEach { it.instance.unhook() }
if (hookedAllConstructors.contains(tag))
hookedAllConstructors[tag]?.takeIf { it.isNotEmpty() }?.forEach { it.instance.unhook() }
hookedAllMethods.remove(tag) hookedAllMethods.remove(tag)
hookedAllConstructors.remove(tag) hookedAllConstructors.remove(tag)
} else hookedMembers.remove(this) } else {
instance.unhook()
runCatching { hookedMembers.remove(this) }
} }
} }
} }