Commit 40aa5c0
committed
fix(DefaultUIController): guard SSL-error dialog against finishing activity (#1065)
Resolves #1065
The crash reported in #1065 is a WindowManager$BadTokenException raised
from DefaultUIController.onShowSslCertificateErrorDialog when AlertDialog
is shown after the hosting Activity has already started its
finishing/destroyed teardown. The WebView delivers SSL error callbacks
on the main thread and there is no guarantee the cached mActivity is
still in a state where it can host a dialog.
This change short-circuits the path when the activity is null, finishing,
or destroyed, calling handler.cancel() in that case so we fail safe
rather than crash. The same check is repeated immediately before
AlertDialog.show(), and the show() call itself is wrapped in a try/catch
for the residual race where the activity transitions between our last
check and the platform call.1 parent 95d48cd commit 40aa5c0
1 file changed
Lines changed: 21 additions & 1 deletion
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
370 | 379 | | |
371 | 380 | | |
372 | 381 | | |
| |||
402 | 411 | | |
403 | 412 | | |
404 | 413 | | |
405 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
406 | 426 | | |
407 | 427 | | |
408 | 428 | | |
| |||
0 commit comments