RebbleOS icon indicating copy to clipboard operation
RebbleOS copied to clipboard

events: fix double free with multiple subscribers

Open frbncis opened this issue 3 years ago • 0 comments

This fixes a double free that occurs when you have multiple subscribers on the same event on the app and overlay threads.

If we have two subscribers (one in the app thread and one in the overlay thread), then the event was being posted to the overlay thread for every subscriber - thus the packet was being destroyed twice

This was encountered when adding a subscriber in notification.c for new notifications.

With this change, subscribers are executed first, then a single post to the overlay thread is made.

frbncis avatar Apr 17 '21 17:04 frbncis