Skip to content

Commit

Permalink
Clear views with delay to fix a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
planarvoid committed Nov 2, 2023
1 parent 67f767f commit 5a3fe76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import org.wordpress.aztec.AztecAttributes
import org.wordpress.aztec.AztecContentChangeWatcher
import org.wordpress.aztec.AztecText
Expand Down Expand Up @@ -519,7 +520,7 @@ class PlaceholderManager(
}
}

private suspend fun clearAllViews() {
private suspend fun clearAllViews() = withContext(Dispatchers.Main){
positionToIdMutex.withLock {
for (placeholder in positionToId) {
container.findViewWithTag<View>(placeholder.uuid)?.let {
Expand Down Expand Up @@ -664,7 +665,7 @@ class PlaceholderManager(
}

override fun beforeHtmlProcessed(source: String): String {
runBlocking {
launch {
clearAllViews()
}
return source
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
gradle.ext.kotlinVersion = '1.6.10'
gradle.ext.agpVersion = '8.1.0'
gradle.ext.agpVersion = '8.1.2'
gradle.ext.automatticPublishToS3Version = '0.8.0'

plugins {
Expand Down

0 comments on commit 5a3fe76

Please sign in to comment.