Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / gl / gl_context_wgl.cc
index 41f1b63..abe47e4 100644 (file)
@@ -74,6 +74,7 @@ bool GLContextWGL::MakeCurrent(GLSurface* surface) {
   if (IsCurrent(surface))
     return true;
 
+  ScopedReleaseCurrent release_current;
   TRACE_EVENT0("gpu", "GLContextWGL::MakeCurrent");
 
   if (!wglMakeCurrent(static_cast<HDC>(surface->GetHandle()), context_)) {
@@ -86,7 +87,6 @@ bool GLContextWGL::MakeCurrent(GLSurface* surface) {
 
   SetCurrent(surface);
   if (!InitializeDynamicBindings()) {
-    ReleaseCurrent(surface);
     return false;
   }
 
@@ -95,6 +95,7 @@ bool GLContextWGL::MakeCurrent(GLSurface* surface) {
     return false;
   }
 
+  release_current.Cancel();
   return true;
 }