Just roll back the entire portion of the commit from b6ec7005ca15 which caused bug 3544 until we figure out what the right static analysis fix is.

This commit is contained in:
Sam Lantinga 2017-01-06 00:40:22 -08:00
parent 70c33e0441
commit 3cbab22892

View file

@ -1894,12 +1894,29 @@ SDL_RenderPresent(SDL_Renderer * renderer)
renderer->RenderPresent(renderer); renderer->RenderPresent(renderer);
} }
/* this isn't responsible for removing the deleted texture from the list! void
(this is to keep static analysis happy in SDL_DestroyRenderer().) */ SDL_DestroyTexture(SDL_Texture * texture)
static void
SDL_DestroyTextureInternal(SDL_Texture * texture)
{ {
SDL_Renderer *renderer = texture->renderer; SDL_Renderer *renderer;
CHECK_TEXTURE_MAGIC(texture, );
renderer = texture->renderer;
if (texture == renderer->target) {
SDL_SetRenderTarget(renderer, NULL);
}
texture->magic = NULL;
if (texture->next) {
texture->next->prev = texture->prev;
}
if (texture->prev) {
texture->prev->next = texture->next;
} else {
renderer->textures = texture->next;
}
if (texture->native) { if (texture->native) {
SDL_DestroyTexture(texture->native); SDL_DestroyTexture(texture->native);
} }
@ -1912,45 +1929,14 @@ SDL_DestroyTextureInternal(SDL_Texture * texture)
SDL_free(texture); SDL_free(texture);
} }
void
SDL_DestroyTexture(SDL_Texture * texture)
{
SDL_Renderer *renderer;
CHECK_TEXTURE_MAGIC(texture, );
renderer = texture->renderer;
if (texture == renderer->target) {
SDL_SetRenderTarget(renderer, NULL);
}
texture->magic = NULL; /* just in case, but we're about to free this... */
if (texture->next) {
texture->next->prev = texture->prev;
}
if (texture->prev) {
texture->prev->next = texture->next;
} else {
renderer->textures = texture->next;
}
SDL_DestroyTextureInternal(texture);
}
void void
SDL_DestroyRenderer(SDL_Renderer * renderer) SDL_DestroyRenderer(SDL_Renderer * renderer)
{ {
SDL_Texture *texture = NULL;
SDL_Texture *nexttexture = NULL;
CHECK_RENDERER_MAGIC(renderer, ); CHECK_RENDERER_MAGIC(renderer, );
SDL_DelEventWatch(SDL_RendererEventWatch, renderer); SDL_DelEventWatch(SDL_RendererEventWatch, renderer);
/* Free existing textures for this renderer */ /* Free existing textures for this renderer */
SDL_SetRenderTarget(renderer, NULL);
while (renderer->textures) { while (renderer->textures) {
SDL_DestroyTexture(renderer->textures); SDL_DestroyTexture(renderer->textures);
} }