check if deleting _Current texobj in _mesa_DeleteTextures (Bart Barenbrug)
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 27 Jul 2001 14:30:50 +0000 (14:30 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 27 Jul 2001 14:30:50 +0000 (14:30 +0000)
src/mesa/main/texobj.c

index 7f46619203ee68421644b2b7b6a59d92bca860c5..a0af0f25abd259abc9290581b3847a83c2293ee7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.49 2001/06/13 14:56:14 brianp Exp $ */
+/* $Id: texobj.c,v 1.50 2001/07/27 14:30:50 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -495,18 +495,26 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName)
                if (delObj == unit->Current1D) {
                   unit->Current1D = ctx->Shared->Default1D;
                   ctx->Shared->Default1D->RefCount++;
+                  if (delObj == unit->_Current)
+                     unit->_Current = unit->Current1D;
                }
                else if (delObj == unit->Current2D) {
                   unit->Current2D = ctx->Shared->Default2D;
                   ctx->Shared->Default2D->RefCount++;
+                  if (delObj == unit->_Current)
+                     unit->_Current = unit->Current2D;
                }
                else if (delObj == unit->Current3D) {
                   unit->Current3D = ctx->Shared->Default3D;
                   ctx->Shared->Default3D->RefCount++;
+                  if (delObj == unit->_Current)
+                     unit->_Current = unit->Current3D;
                }
                else if (delObj == unit->CurrentCubeMap) {
                   unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
                   ctx->Shared->DefaultCubeMap->RefCount++;
+                  if (delObj == unit->_Current)
+                     unit->_Current = unit->CurrentCubeMap;
                }
             }
             ctx->NewState |= _NEW_TEXTURE;