jenius-apps / ambie

An app that uses white noise, nature sounds, and focus features to boost your productivity.
https://ambieapp.com
MIT License
1.89k stars 143 forks source link

Attempting to fix tcs issue by using semaphore #357

Closed dpaulino closed 1 year ago

validvoid commented 1 year ago

I think this workaround should work. I am thinking that we should unsubscribe the mediaOpened and mediaFailed events in the event handlers and register them in AssignSource instead of doing the registration in the ctor.

dpaulino commented 1 year ago

I think this workaround should work. I am thinking that we should unsubscribe the mediaOpened and mediaFailed events in the event handlers and register them in AssignSource instead of doing the registration in the ctor.

Moving it to assignSource might get tricky since it can be called multiple times, so we'd have to add extra logic to ensure it's only registered once. I think the current approach in ctor should be fine. But let's do this: I'll merge this pr first and check if crashes go down. If not, let's revisit the event handlers in a new pr.