From 361be28223c2ccdeb2b8c883284580923ceee8f0 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 17 May 2021 10:49:27 +1000 Subject: [PATCH] Fix group deletion --- .../thoughtcrime/securesms/loki/api/PublicChatManager.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PublicChatManager.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/api/PublicChatManager.kt index 22878d46fd..c270797c6c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PublicChatManager.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/api/PublicChatManager.kt @@ -11,6 +11,7 @@ import org.session.libsession.messaging.sending_receiving.pollers.OpenGroupPolle import org.session.libsession.messaging.sending_receiving.pollers.OpenGroupV2Poller import org.session.libsession.utilities.TextSecurePreferences import org.session.libsession.utilities.Util +import org.session.libsignal.utilities.ThreadUtils import org.thoughtcrime.securesms.database.DatabaseContentProviders import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.groups.GroupManager @@ -138,9 +139,10 @@ class PublicChatManager(private val context: Context) { val groupId = OpenGroup.getId(channel, server) val threadId = GroupManager.getOpenGroupThreadID(groupId, context) val groupAddress = threadDB.getRecipientForThreadId(threadId)!!.address.serialize() - GroupManager.deleteGroup(groupAddress, context) - - Util.runOnMain { startPollersIfNeeded() } + ThreadUtils.queue { + GroupManager.deleteGroup(groupAddress, context) // Must be invoked on a background thread + Util.runOnMain { startPollersIfNeeded() } + } } fun removeChat(server: String, room: String) {