Skip to content

Commit 8f903e3

Browse files
committed
Merge branch 'no-waiting-webview'
2 parents 2b12d69 + 493b4a8 commit 8f903e3

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

README-CHANGES.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,14 @@
226226
<c:change date="2026-01-12T00:00:00+00:00" summary="Fix night mode visual issues."/>
227227
</c:changes>
228228
</c:release>
229-
<c:release date="2026-01-16T09:57:36+00:00" is-open="true" ticket-system="org.lyrasis.jira" version="6.12.0">
230-
<c:changes/>
229+
<c:release date="2026-01-30T10:41:59+00:00" is-open="true" ticket-system="org.lyrasis.jira" version="6.12.0">
230+
<c:changes>
231+
<c:change date="2026-01-30T10:41:59+00:00" summary="Correct a possible ANR.">
232+
<c:tickets>
233+
<c:ticket id="PP-3577"/>
234+
</c:tickets>
235+
</c:change>
236+
</c:changes>
231237
</c:release>
232238
</c:releases>
233239
<c:ticket-systems>

org.librarysimplified.r2.vanilla/src/main/java/org/librarysimplified/r2/vanilla/internal/SR2Controller.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import org.librarysimplified.r2.api.SR2Locator.SR2LocatorChapterEnd
3737
import org.librarysimplified.r2.api.SR2Locator.SR2LocatorPercent
3838
import org.librarysimplified.r2.api.SR2PageNumberingMode
3939
import org.librarysimplified.r2.api.SR2Theme
40+
import org.librarysimplified.r2.ui_thread.SR2UIThread
4041
import org.librarysimplified.r2.vanilla.BuildConfig
4142
import org.readium.r2.shared.ExperimentalReadiumApi
4243
import org.readium.r2.shared.publication.Href
@@ -141,8 +142,7 @@ internal class SR2Controller private constructor(
141142
val publicationOpener =
142143
PublicationOpener(
143144
publicationParser = publicationParser,
144-
contentProtections =
145-
configuration.contentProtections,
145+
contentProtections = configuration.contentProtections,
146146
onCreatePublication = {
147147
},
148148
)
@@ -723,7 +723,7 @@ internal class SR2Controller private constructor(
723723
this.logger.debug("{} Failed to set scroll mode: ", this.name(), exception)
724724
}
725725
}.thenCompose {
726-
this.executeThemeSet(this.waitForWebViewAvailability(), this.themeNow())
726+
this.executeThemeSet(connection, this.themeNow())
727727
}.handle { _, exception ->
728728
if (exception != null) {
729729
this.logger.debug("{} Failed to set theme: ", this.name(), exception)
@@ -1193,6 +1193,10 @@ internal class SR2Controller private constructor(
11931193
*/
11941194

11951195
private fun waitForWebViewAvailability(): SR2WebViewConnectionType {
1196+
check(!SR2UIThread.isUIThread()) {
1197+
"Waiting for the web view on the UI thread is not permitted."
1198+
}
1199+
11961200
while (true) {
11971201
synchronized(this.webViewConnectionLock) {
11981202
val webView = this.webViewConnection

0 commit comments

Comments
 (0)