bfroggio / screm

A Windows soundboard controlled via keyboard shortcuts and Twitch chat
MIT License
3 stars 2 forks source link

Fixing potential mutext leak. #20

Closed xuther closed 3 years ago

xuther commented 3 years ago

I ran into this as I was testing some stuff. Figured it was better to get it in sooner than later.

xuther commented 3 years ago

@jessemillar for the notification.

jessemillar commented 3 years ago

@xuther Been a while since I've dealt with mutexes. What was the issue and how does this fix it? #education

xuther commented 3 years ago

Essentially just that the mutex is acquired and then there's a valid (non-shutdown) codepath that returns without unlocking (if the error on line 334 is not nil). So if that error is handled, but the program doesn't exit, subsequent calls to lock the mutex would block forever.

jessemillar commented 3 years ago

This actually fixes #17. Awesome!

jessemillar commented 3 years ago

@xuther Add me on Discord so we can chat in a more longform fashion. B-Froggio#6354