Ensure that the Rust room is not closed while the driver needs it. (#4694)
This commit is contained in:
parent
5fb0fc0d50
commit
0beec202a5
3 changed files with 4 additions and 1 deletions
|
|
@ -48,7 +48,6 @@ class DefaultCallWidgetProvider @Inject constructor(
|
|||
).getOrThrow()
|
||||
|
||||
val driver = room.getWidgetDriver(widgetSettings).getOrThrow()
|
||||
room.destroy()
|
||||
|
||||
CallWidgetProvider.GetWidgetResult(
|
||||
driver = driver,
|
||||
|
|
|
|||
|
|
@ -595,6 +595,7 @@ class JoinedRustRoom(
|
|||
RustWidgetDriver(
|
||||
widgetSettings = widgetSettings,
|
||||
room = innerRoom,
|
||||
joinedRustRoom = this,
|
||||
widgetCapabilitiesProvider = object : WidgetCapabilitiesProvider {
|
||||
override fun acquireCapabilities(capabilities: WidgetCapabilities): WidgetCapabilities {
|
||||
return getElementCallRequiredPermissions(sessionId.value, baseRoom.deviceId.value)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ package io.element.android.libraries.matrix.impl.widget
|
|||
|
||||
import io.element.android.libraries.matrix.api.widget.MatrixWidgetDriver
|
||||
import io.element.android.libraries.matrix.api.widget.MatrixWidgetSettings
|
||||
import io.element.android.libraries.matrix.impl.room.JoinedRustRoom
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
|
|
@ -24,6 +25,7 @@ import kotlin.coroutines.coroutineContext
|
|||
class RustWidgetDriver(
|
||||
widgetSettings: MatrixWidgetSettings,
|
||||
private val room: Room,
|
||||
private val joinedRustRoom: JoinedRustRoom,
|
||||
private val widgetCapabilitiesProvider: WidgetCapabilitiesProvider,
|
||||
) : MatrixWidgetDriver {
|
||||
// It's important to have extra capacity here to make sure we don't drop any messages
|
||||
|
|
@ -69,5 +71,6 @@ class RustWidgetDriver(
|
|||
override fun close() {
|
||||
receiveMessageJob?.cancel()
|
||||
driverAndHandle.driver.close()
|
||||
joinedRustRoom.destroy()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue