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

Make CFRunLoopMode a safe wrapper with a lifetime #650

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kevinmehall
Copy link

Fixes #648: the safe methods that take CFRunLoopMode are currently unsound because it is a raw pointer that is not necessarily valid.

As a bonus, this allows use of kCFRunLoopCommonModes and kCFRunLoopDefaultMode constants without unsafe.

I considered just making mode a &CFString, but it seems that the implementation compares the pointer values, so this way ensures that the constants are passed as the pointers it expects. I don't understand the purpose or usage of mode very well, so correct me if this is not ideal.

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.

Safe CFRunLoop methods accept and dereference a raw pointer
1 participant