Delete the old texture storage first so that 0x0 textures have no stale data.

TRAC #23127
Signed-off-by: Geoff Lang
Signed-off-by: Jamie Madill
Author: Nicolas Capens

git-svn-id: http://angleproject.googlecode.com/svn/trunk@2208 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index 27791f0..db66e14 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 2184
+#define BUILD_REVISION 2208
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index e3e8941..71ec4d8 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
@@ -2160,6 +2160,9 @@
 // Constructs a Direct3D 9 texture resource from the texture images
 void Texture2D::createTexture()
 {
+    delete mTexStorage;
+    mTexStorage = NULL;
+
     GLsizei width = mImageArray[0].getWidth();
     GLsizei height = mImageArray[0].getHeight();
 
@@ -2170,7 +2173,6 @@
     D3DFORMAT d3dfmt = mImageArray[0].getD3DFormat();
     DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
 
-    delete mTexStorage;
     mTexStorage = new TextureStorage2D(levels, d3dfmt, d3dusage, width, height);
     
     if (mTexStorage->isManaged())
@@ -2708,6 +2710,9 @@
 // Constructs a Direct3D 9 texture resource from the texture images, or returns an existing one
 void TextureCubeMap::createTexture()
 {
+    delete mTexStorage;
+    mTexStorage = NULL;
+
     GLsizei size = mImageArray[0][0].getWidth();
 
     if (!(size > 0))
@@ -2717,7 +2722,6 @@
     D3DFORMAT d3dfmt = mImageArray[0][0].getD3DFormat();
     DWORD d3dusage = GetTextureUsage(d3dfmt, mUsage, false);
 
-    delete mTexStorage;
     mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, d3dusage, size);
 
     if (mTexStorage->isManaged())