Skip to content

Commit

Permalink
fixed leak dispatching alerts
Browse files Browse the repository at this point in the history
Fixed potential leak when disconnecting from the GUI, and at the same
time dispatching an alert/message to the GUI.
  • Loading branch information
gustavo-iniguez-goya committed Dec 31, 2023
1 parent 68c2c8a commit 050e3c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion daemon/ui/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ func (c *Client) alertsDispatcher() {
}

func (c *Client) dispatchAlert(pbAlert protocol.Alert) {
if c.client == nil {
c.RLock()
isDisconnected := c.client == nil
c.RUnlock()
if isDisconnected {
return
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
Expand Down

0 comments on commit 050e3c5

Please sign in to comment.