From 2eee25bbc19a21ba631ba942980fc9d5a5ef0369 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 3 Jul 2019 19:36:25 +0200 Subject: [PATCH] Fix / crash not called on UI Thread --- .../vector/riotx/features/popup/PopupAlertManager.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/popup/PopupAlertManager.kt b/vector/src/main/java/im/vector/riotx/features/popup/PopupAlertManager.kt index 7382ad9f..26e50de6 100644 --- a/vector/src/main/java/im/vector/riotx/features/popup/PopupAlertManager.kt +++ b/vector/src/main/java/im/vector/riotx/features/popup/PopupAlertManager.kt @@ -45,7 +45,9 @@ object PopupAlertManager { synchronized(alertFiFo) { alertFiFo.add(alert) } - displayNextIfPossible() + weakCurrentActivity?.get()?.runOnUiThread { + displayNextIfPossible() + } } fun cancelAlert(uid: String) { @@ -62,8 +64,10 @@ object PopupAlertManager { //it could also be the current one if (currentAlerter?.uid == uid) { - Alerter.hide() - currentIsDismissed() + weakCurrentActivity?.get()?.runOnUiThread { + Alerter.hide() + currentIsDismissed() + } } }