Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mutexes to adding buttons and button image writes #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

derickr
Copy link
Contributor

@derickr derickr commented Sep 15, 2023

When running AddButton in a go-routine, I received the following errors:

fatal error: concurrent map writes

goroutine 13 [running]:
github.com/magicmonkey/go-streamdeck.(*StreamDeck).AddButton(0xc000122a68, 0xe?, {0x8b68e0, 0xc0000aa050})
	/home/derick/dev/go/src/github.com/magicmonkey/go-streamdeck/streamdeck.go:59 +0xa7
github.com/derickr/streamdeck-goui/addons.(*Clock).Init.func1(0x6)
	/home/derick/dev/go/src/github.com/derickr/streamdeck-goui/addons/clock.go:70 +0x7b7
created by github.com/derickr/streamdeck-goui/addons.(*Clock).Init
	/home/derick/dev/go/src/github.com/derickr/streamdeck-goui/addons/clock.go:48 +0x30

It turned out that the method did not use a mutex for this.

Similarly, I frequently got corrupt images, and the addition of the mutex to the function that writes these images to the Stream Deck fixes that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant