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

Fix thread safety in DelayedFuncTask class #5

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

Conversation

p0358
Copy link

@p0358 p0358 commented Nov 14, 2022

RunFrame() was accessing m_delayedFuncs insecurely without holding a lock on mutex.

I also changed std::mutex to std::recursive_mutex, because if a delayed func called from RunFrame() calls AddFunc() again itself, it would create a deadlock with normal mutex...

@p0358
Copy link
Author

p0358 commented Nov 14, 2022

Actually now that I think about it, TTF2SDK::AddFrameTask and then removal in main frame hook is also unsafe, idk if the codebase assumes a possibility someone might add frame task from another thread, I see so far the only AddFrameTask calls are done in main thread... Should I fix it too?

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

Successfully merging this pull request may close these issues.

1 participant