This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug 1579 - Creating a texture with unsupported format may cause…
… double-destruction Alexander Hirsch 2012-08-25 20:01:29 PDT When creating a SDL_Texture with unsupported format (I'll now refer to it as texture A), SDL_CreateTexture will call SDL_CreateTexture again with GetClosestSupportedFormat to set texture->native (which I will now refer to as texture B). This causes texture B to be put before A in renderer->textures. If texture A is explicitly destroyed, everything is fine. Otherwise, upon SDL_DestroyRenderer, the loop will first encounter texture B, destroy it, then texture A, destroy that which will want to destroy texture->native and since it is already destroyed set an error. The solution could be as simple as swapping texture A with B after texture->native gets set in SDL_CreateTextures.
- Loading branch information