Skip to content

Commit

Permalink
Cache children when traversing to prevent concurrent modification issues
Browse files Browse the repository at this point in the history
  • Loading branch information
idyatlov committed Jul 31, 2024
1 parent 240739f commit 6904fc4
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,20 @@ import io.appium.espressoserver.lib.viewaction.ViewGetter
import org.w3c.dom.NodeList
import org.xml.sax.InputSource
import org.xmlpull.v1.XmlSerializer
import java.io.*
import java.util.*
import java.io.BufferedReader
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.FileOutputStream
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.UUID
import java.util.concurrent.Semaphore
import javax.xml.xpath.*
import javax.xml.xpath.XPath
import javax.xml.xpath.XPathConstants
import javax.xml.xpath.XPathExpression
import javax.xml.xpath.XPathExpressionException
import javax.xml.xpath.XPathFactory
import kotlin.reflect.full.declaredMemberFunctions
import kotlin.reflect.jvm.isAccessible

Expand Down Expand Up @@ -240,8 +250,9 @@ class SourceDocument constructor(

if (depth < MAX_TRAVERSAL_DEPTH) {
// Visit the children and build them too
for (index in 0 until semanticsNode.children.count()) {
serializeComposeNode(semanticsNode.children[index], depth + 1)
val children = semanticsNode.children
for (index in 0 until children.count()) {
serializeComposeNode(children[index], depth + 1)
}
} else {
AndroidLogger.warn(
Expand Down

0 comments on commit 6904fc4

Please sign in to comment.