Revert "[3.0] Fix crash in wayland"
[platform/core/uifw/dali-adaptor.git] / adaptors / wayland / window-render-surface-wl.cpp
index b5c07ad..f2d83ba 100644 (file)
@@ -50,8 +50,7 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
                                           const std::string& name,
                                           bool isTransparent)
 : EcoreWlRenderSurface( positionSize, surface, name, isTransparent ),
-  mEglWindow( NULL ),
-  mNeedToApproveDeiconify( false )
+  mNeedToApproveDeiconify(false)
 {
   DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
   Init( surface );
@@ -59,12 +58,6 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
 
 WindowRenderSurface::~WindowRenderSurface()
 {
-  if( mEglWindow != NULL )
-  {
-    wl_egl_window_destroy(mEglWindow);
-    mEglWindow = NULL;
-  }
-
   if( mOwnSurface )
   {
     ecore_wl_window_free( mWlWindow );
@@ -120,18 +113,15 @@ void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
   eglImpl.DestroySurface();
+  wl_egl_window_destroy(mEglWindow);
+  mEglWindow = NULL;
 }
 
 bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
 
-  if( mEglWindow != NULL )
-  {
-    wl_egl_window_destroy(mEglWindow);
-    mEglWindow = NULL;
-  }
-
+  wl_egl_window_destroy(mEglWindow);
   mEglWindow = wl_egl_window_create(ecore_wl_window_surface_get(mWlWindow), mPosition.width, mPosition.height);
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );