Skip to content
Snippets Groups Projects
Commit ccb1bdf3 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Prevent Thread races by creating a copy

parent 92a67aba
Branches
Tags
No related merge requests found
......@@ -62,12 +62,12 @@ class BufferListAdapter(
init {
liveData.zip(collapsedNetworks.toLiveData(), selectedBuffer.toLiveData()).observe(
lifecycleOwner, Observer { it: Triple<List<BufferProps>?, Set<NetworkId>, BufferId>? ->
val old: List<BufferListItem> = ArrayList(data)
runInBackground {
val list = it?.first ?: emptyList()
val collapsedNetworks = it?.second ?: emptySet()
val selected = it?.third ?: -1
val old: List<BufferListItem> = data
val new: List<BufferListItem> = list.sortedBy { props ->
!props.info.type.hasFlag(Buffer_Type.StatusBuffer)
}.sortedBy { props ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment