Deleting program does not delete shaders that are marked

TRAC #12012

Also fixes failure to delete flagged program upon glUseProgram(0).

Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch

Author:    Andrew Lewycky

git-svn-id: https://angleproject.googlecode.com/svn/trunk@201 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Shader.cpp b/src/libGLESv2/Shader.cpp
index 2abbd61..65799c4 100644
--- a/src/libGLESv2/Shader.cpp
+++ b/src/libGLESv2/Shader.cpp
@@ -185,6 +185,11 @@
 void Shader::detach()
 {
     mAttachCount--;
+
+    if (mAttachCount == 0 && mDeleteStatus)
+    {
+        getContext()->deleteShader(mHandle);
+    }
 }
 
 bool Shader::isAttached() const
@@ -192,11 +197,6 @@
     return mAttachCount > 0;
 }
 
-bool Shader::isDeletable() const
-{
-    return mDeleteStatus == true && mAttachCount == 0;
-}
-
 bool Shader::isFlaggedForDeletion() const
 {
     return mDeleteStatus;