Fix the crash while replacing the surface
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / native-render-surface-ecore-wl.cpp
index 66364cc..e019b0a 100644 (file)
@@ -33,8 +33,8 @@
 
 // INTERNAL INCLUDES
 #include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/window-system/common/display-connection.h>
 #include <dali/internal/window-system/common/window-system.h>
 #include <dali/integration-api/thread-synchronization-interface.h>
@@ -54,6 +54,7 @@ Debug::Filter* gNativeSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, fals
 NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, bool isTransparent )
 : mPosition( positionSize ),
   mRenderNotification( NULL ),
+  mGraphics( NULL ),
   mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
   mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ),
   mOwnSurface( false ),
@@ -197,10 +198,6 @@ void NativeRenderSurfaceEcoreWl::MoveResize( Dali::PositionSize positionSize )
 {
 }
 
-void NativeRenderSurfaceEcoreWl::SetViewMode( ViewMode viewMode )
-{
-}
-
 void NativeRenderSurfaceEcoreWl::StartRender()
 {
 }
@@ -214,9 +211,12 @@ bool NativeRenderSurfaceEcoreWl::PreRender( bool )
 void NativeRenderSurfaceEcoreWl::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface )
 {
   auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics *>(mGraphics);
-  Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+  if ( eglGraphics )
+  {
+    Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
 
-  eglImpl.SwapBuffers();
+    eglImpl.SwapBuffers();
+  }
 
   if( mThreadSynchronization )
   {