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 thread safety to WIC initialization using call_once #807

Open
wants to merge 2 commits into
base: uwp/main
Choose a base branch
from

Conversation

benstevens48
Copy link

Technically the singleton DefaultWicAdapter instance was not thread-safe when creating the WIC factory. Similarly, the DefaultCanvasImageAdapter was not thread-safe when storing a copy of the WicAdapter instance. In the second case in practice it probably was thread-safe anyway assuming setting a pointer is atomic. In the first case it would probably have been very difficult to hit a serious issue, although potentially it could have leaked the factory object and potentially returned a different instance on different calls.

This pull request fixes that by using std::call_once.

@MartyIX
Copy link

MartyIX commented Jul 16, 2024

Will this get merged please?

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.

3 participants