From 8be134151aba5713a96c68291b00c6fa74d92798 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 2 Oct 2012 00:28:23 -0700 Subject: [PATCH] Fixed texture list when swapping textures (thanks Drake Wilson!) --- src/render/SDL_render.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index db6ee2e98..04b5d6ba5 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -418,7 +418,13 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int /* Swap textures to have texture before texture->native in the list */ texture->native->next = texture->next; + if (texture->native->next) { + texture->native->next->prev = texture->native; + } texture->prev = texture->native->prev; + if (texture->prev) { + texture->prev->next = texture; + } texture->native->prev = texture; texture->next = texture->native; renderer->textures = texture;