aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/room-list.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/ui/room-list.go b/ui/room-list.go
index 0dc3e74..6b22c8e 100644
--- a/ui/room-list.go
+++ b/ui/room-list.go
@@ -438,11 +438,11 @@ func (list *RoomList) clickRoom(line, column int, mod bool) bool {
return false
}
list.RLock()
- defer list.RUnlock()
for _, tag := range list.tags {
trl := list.items[tag]
if line--; line == -1 {
trl.ToggleCollapse()
+ list.RUnlock()
return true
}
@@ -453,7 +453,9 @@ func (list *RoomList) clickRoom(line, column int, mod bool) bool {
if line < 0 {
break
} else if line < trl.Length() {
- list.parent.SwitchRoom(tag, trl.Visible()[trl.Length()-1-line].Room)
+ switchToRoom := trl.Visible()[trl.Length()-1-line].Room
+ list.RUnlock()
+ list.parent.SwitchRoom(tag, switchToRoom)
return true
}
@@ -482,6 +484,7 @@ func (list *RoomList) clickRoom(line, column int, mod bool) bool {
// Tag footer
line--
}
+ list.RUnlock()
return false
}