-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Updated more functions to use SDL_GetStringRule #10311
Conversation
…free the memory later.
cb1b93f
to
11ff4dc
Compare
@icculus, I made it possible to free specific pointers with SDL_FreeEventMemory(), which some applications will want to do for more fine grained memory management. |
f3a2cc2
to
1b68065
Compare
Also clarify in the documentation that you should not call SDL_FreeEventMemory(NULL) from your main thread.
a9d895d
to
2d81f99
Compare
615524b
to
331bf8d
Compare
This allows threads to free memory from their local pool without affecting events that are queued, and to transfer memory ownership cleanly between threads that are queuing and dequeuing events.
This prevents race conditions where calling an API from one thread returns the data and it's freed by updates on another thread
…ow the SDL_GetStringRule
Also removed the distinction between SDL_GUID and SDL_JoystickGUID
@sezero, I will have an sdl2-compat update ready soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good. I think what prompted my "are we being too clever?" comment before was the actual presence of a "rule" ...because this is exactly the sort of thing that made, say, Objective-C memory management a nightmare. You had to know the rules which were special and magical and tucked away in a different chapter of the manual and had 20 exceptions.
No formal rule, just a single line of text in these functions that says "this is temporary memory that will be free'd later, but you can claim it now with ClaimMemory"? Honestly, it makes me feel like we aren't accidentally driving over a cliff now.
Clever, in a good way! :)
Once this merges, in addition to the sdl2-compat stuff, though, someone should delete SDL3/SDL_GetStringRule.md from the wiki. |
Sure, I'll do that. |
Fixes #10300