Fixed texture list when swapping textures (thanks Drake Wilson!)
authorSam Lantinga <slouken@libsdl.org>
Tue, 02 Oct 2012 00:28:23 -0700
changeset 6533 c784245304dd
parent 6532 58f726a2fc82
child 6534 8faa51147576
Fixed texture list when swapping textures (thanks Drake Wilson!)
src/render/SDL_render.c
--- a/src/render/SDL_render.c	Mon Oct 01 23:28:19 2012 -0700
+++ b/src/render/SDL_render.c	Tue Oct 02 00:28:23 2012 -0700
@@ -418,7 +418,13 @@
 
         /* 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;