Call SDL_Quit before SDL_Destroy

New to SDL. What will happen if I call SDL_Quit before SDL_Destory… functions? I have some of my objects(window and renderer) wrapped into std::unique_ptr in C++.

First of, if you wrap sdl types into smart pointers, you should probably write a custom deleter so that they are freed with the appropriate function. Ill give you an example, but don’t blame me if there are any errors:

On to your actual question:
SDL_Quit() will shut down all subsystems, but this will not ensure that your surfaces, renderers and whatnot are freed properly. Still, do NOT use them afterwards!

In the end, if you just SDL_Quit() and then exit your program, the OS will take care of cleaning up. This is not nice however! A clean exit is always the preferred choice.

Hope that helps

Be careful and I would recommend cleaning up before you call SDL_Quit();

I have had crashes with GameControllers not been cleaned up before calling SDL_Quit() because unique_ptrs will only call there custom_deleter when they go out of scope.