Just roll back the entire portion of the commit from a8253d439914 which caused bug 3544 until we figure out what the right static analysis fix is.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 4b88459..8309fab 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1894,24 +1894,6 @@ SDL_RenderPresent(SDL_Renderer * renderer)
renderer->RenderPresent(renderer);
}
-/* this isn't responsible for removing the deleted texture from the list!
- (this is to keep static analysis happy in SDL_DestroyRenderer().) */
-static void
-SDL_DestroyTextureInternal(SDL_Texture * texture)
-{
- SDL_Renderer *renderer = texture->renderer;
- if (texture->native) {
- SDL_DestroyTexture(texture->native);
- }
- if (texture->yuv) {
- SDL_SW_DestroyYUVTexture(texture->yuv);
- }
- SDL_free(texture->pixels);
-
- renderer->DestroyTexture(renderer, texture);
- SDL_free(texture);
-}
-
void
SDL_DestroyTexture(SDL_Texture * texture)
{
@@ -1924,7 +1906,7 @@ SDL_DestroyTexture(SDL_Texture * texture)
SDL_SetRenderTarget(renderer, NULL);
}
- texture->magic = NULL; /* just in case, but we're about to free this... */
+ texture->magic = NULL;
if (texture->next) {
texture->next->prev = texture->prev;
@@ -1935,22 +1917,26 @@ SDL_DestroyTexture(SDL_Texture * texture)
renderer->textures = texture->next;
}
- SDL_DestroyTextureInternal(texture);
+ if (texture->native) {
+ SDL_DestroyTexture(texture->native);
+ }
+ if (texture->yuv) {
+ SDL_SW_DestroyYUVTexture(texture->yuv);
+ }
+ SDL_free(texture->pixels);
+
+ renderer->DestroyTexture(renderer, texture);
+ SDL_free(texture);
}
void
SDL_DestroyRenderer(SDL_Renderer * renderer)
{
- SDL_Texture *texture = NULL;
- SDL_Texture *nexttexture = NULL;
-
CHECK_RENDERER_MAGIC(renderer, );
SDL_DelEventWatch(SDL_RendererEventWatch, renderer);
/* Free existing textures for this renderer */
- SDL_SetRenderTarget(renderer, NULL);
-
while (renderer->textures) {
SDL_DestroyTexture(renderer->textures);
}