mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
fix(GODT-2426): Fix crash on user delete
Ensure we are always acquiring a write lock when modifying the user's `updateCh` contents.
This commit is contained in:
@ -312,7 +312,7 @@ func (user *User) handleUpdateAddressEvent(_ context.Context, event proton.Addre
|
||||
}
|
||||
|
||||
return nil
|
||||
}, user.apiAddrsLock)
|
||||
}, user.apiAddrsLock, user.updateChLock)
|
||||
}
|
||||
|
||||
func (user *User) handleDeleteAddressEvent(_ context.Context, event proton.AddressEvent) error {
|
||||
|
||||
@ -553,7 +553,7 @@ func (user *User) Close() {
|
||||
user.client.Close()
|
||||
|
||||
// Close the user's update channels.
|
||||
safe.RLock(func() {
|
||||
safe.Lock(func() {
|
||||
for _, updateCh := range xslices.Unique(maps.Values(user.updateCh)) {
|
||||
updateCh.CloseAndDiscardQueued()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user