my application uses both, SDL_QUIT and SDL_WINDOWEVENT_CLOSE, to detect if the user requests to quit. It then warns that unsaved data might be lost and offers an option to cancel quit. The corresponding dialog exits, if another SDL_QUIT or SDL_WINDOWEVENT_CLOSE is received. My system sends both events at the same time with SDL_WINDOWEVENT_CLOSE preceding SDL_QUIT. This secondary SDL_QUIT event would cause my application to close without warning. So to make my application work as intended I do a SDL_FlushEvent(SDL_QUIT) when receiving an SDL_WINDOW_CLOSE event. This seems to work reliably on macOS.
Now my queistion is:
Is it guaranteed that SDL_QUIT always follows immediately after SDL_WINDOW_CLOSE or might there be a delay between these two events or might they occur in different order?
Of course I know that there are situations where SDL_QUIT or SDL_WINDOW_CLOSE occur alone. That does not matter for my question.