Skip to content

Commit

Permalink
fix(popups): Fix goroutine leak in both HUD and Notifications
Browse files Browse the repository at this point in the history
This likely leaks callbacks too, and eventually crashes.
  • Loading branch information
pdf committed Mar 28, 2024
1 parent 4515ab5 commit d3fbbc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cmd/hyprpanel-client/hud.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ func (h *hud) update(data *eventv1.HudNotificationValue) error {
h.showNotification()

go func() {
<-h.timer.C
select {
case <-h.timer.C:
case <-h.itemClosed:
}
h.closeItem()
}()

Expand Down
6 changes: 5 additions & 1 deletion cmd/hyprpanel-client/notification_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ func (i *notificationItem) build(container *gtk.Box) error {
})

go func() {
<-i.timer.C
select {
case <-i.timer.C:
case <-i.closed:
}

i.close()
}()

Expand Down

0 comments on commit d3fbbc6

Please sign in to comment.