Merge "Remove EGL surface in the update thread" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-render-surface.cpp
index e1a344f..c95d508 100644 (file)
@@ -85,11 +85,6 @@ WindowRenderSurface::~WindowRenderSurface()
   {
     delete mRotationTrigger;
   }
-
-  if ( mEGLSurface )
-  {
-    DestroySurface();
-  }
 }
 
 void WindowRenderSurface::Initialize( Any surface )
@@ -264,7 +259,13 @@ void WindowRenderSurface::DestroySurface()
     DALI_LOG_RELEASE_INFO("WindowRenderSurface::DestroySurface: WinId (%d)\n", mWindowBase->GetNativeWindowId() );
 
     Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+
     eglImpl.DestroySurface( mEGLSurface );
+    mEGLSurface = nullptr;
+
+    // Destroy context also
+    eglImpl.DestroyContext( mEGLContext );
+    mEGLContext = nullptr;
 
     mWindowBase->DestroyEglWindow();
   }