Skip to content

Commit 90f9595

Browse files
Add one more try/catch block to prevent catastrophic failures in Compose
1 parent 51b59d6 commit 90f9595

File tree

1 file changed

+7
-1
lines changed
  • lets-plot-compose/src/desktopMain/kotlin/org/jetbrains/letsPlot/skia/compose

1 file changed

+7
-1
lines changed

lets-plot-compose/src/desktopMain/kotlin/org/jetbrains/letsPlot/skia/compose/PlotPanelRaw.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ actual fun PlotPanelRaw(
8484

8585
DisposableEffect(plotContainer) {
8686
onDispose {
87-
plotContainer.dispose()
87+
// Try/catch to ensure that any exception in dispose() does not break the Composable lifecycle
88+
// Otherwise, the app window gets unclosable.
89+
try {
90+
plotContainer.dispose()
91+
} catch (e: Exception) {
92+
LOG.error(e) { "PlotContainer.dispose() failed" }
93+
}
8894
}
8995
}
9096

0 commit comments

Comments
 (0)