mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-03 14:14:26 +02:00
fix: ConcurrentModificationException
while iterating through proxies
and modifying it
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
beff1df9b0
commit
6cb7cdb0b2
@ -15,18 +15,21 @@ class ProxyBackedClassList(internal val internalClasses: MutableList<ClassDef>)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply all resolved classes into [internalClasses] and clear the [proxies] list.
|
* Apply all resolved classes into [internalClasses] and clean the [proxies] list.
|
||||||
*/
|
*/
|
||||||
fun applyProxies() {
|
fun applyProxies() {
|
||||||
proxies.forEachIndexed { i, proxy ->
|
// FIXME: check if this could cause issues when multiple patches use the same proxy
|
||||||
if (!proxy.proxyUsed) return@forEachIndexed
|
proxies.removeIf { proxy ->
|
||||||
|
// if the proxy is unused, keep it in the list
|
||||||
|
if (!proxy.proxyUsed) return@removeIf false
|
||||||
|
|
||||||
|
// if it has been used, replace the internal class which it proxied
|
||||||
val index = internalClasses.indexOfFirst { it.type == proxy.immutableClass.type }
|
val index = internalClasses.indexOfFirst { it.type == proxy.immutableClass.type }
|
||||||
internalClasses[index] = proxy.mutatedClass
|
internalClasses[index] = proxy.mutatedClass
|
||||||
|
|
||||||
proxies.removeAt(i) // FIXME: check if this could cause issues when multiple patches use the same proxy
|
// return true to remove it from the proxies list
|
||||||
|
return@removeIf true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override val size get() = internalClasses.size
|
override val size get() = internalClasses.size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user