Fix lost context recovery for Windows XP.

Issue=138
TRAC #16271
Signed-off-by: Daniel Koch
Author: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@657 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libEGL/Display.cpp b/src/libEGL/Display.cpp
index 4dcaa0a..675097f 100644
--- a/src/libEGL/Display.cpp
+++ b/src/libEGL/Display.cpp
@@ -581,6 +581,12 @@
     }
     else if (isDeviceLost())   // Lost device
     {
+        // Release surface resources to make the Reset() succeed
+        for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
+        {
+            (*surface)->release();
+        }
+
         if (!resetDevice())
         {
             return NULL;
@@ -611,14 +617,6 @@
 {
     glDestroyContext(context);
     mContextSet.erase(context);
-
-    if (mContextSet.empty() && mDevice && isDeviceLost())   // Last context of a lost device
-    {
-        for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
-        {
-            (*surface)->release();
-        }	
-    }
 }
 
 bool Display::isInitialized() const