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

Thread safety violation in windows::grab::grab #123

Open
OpatrilPeter opened this issue Dec 21, 2023 · 0 comments
Open

Thread safety violation in windows::grab::grab #123

OpatrilPeter opened this issue Dec 21, 2023 · 0 comments

Comments

@OpatrilPeter
Copy link

Hi, I was randomly browsing your repo and the line

GLOBAL_CALLBACK = Some(Box::new(callback));

struck me. There's no synchronization when modifying this static mut and it's code directly reachable from client code, making it thread unsafe.

I'd recommend to add a mutex or mark that function unsafe. If you plan to keep it safe, I'd also recommend making sure the raw_callback is aware of callback change too. Checking if this idiom isn't used incorrectly elsewhere might help too.

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

No branches or pull requests

1 participant