Delete EglGraphics and shutdown EGL 55/233255/3
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 13 May 2020 08:05:56 +0000 (17:05 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 19 May 2020 01:51:41 +0000 (01:51 +0000)
Change-Id: Iaaa267481aad15172f8e9e26fd9cc85384dfbb83

dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/combined-update-render-controller.cpp
dali/internal/graphics/common/graphics-interface.h

index 188c64e..737845d 100755 (executable)
@@ -161,10 +161,11 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   DALI_ASSERT_DEBUG( defaultWindow->GetSurface() && "Surface not initialized" );
 
-  mGraphics = &( graphicsFactory.Create() );
+  mGraphics = std::unique_ptr< GraphicsInterface >( &graphicsFactory.Create() );
   mGraphics->Initialize( mEnvironmentOptions );
 
-  auto eglGraphics = static_cast<EglGraphics *>( mGraphics ); // This interface is temporary until Core has been updated to match
+  GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match
+  auto eglGraphics = static_cast<EglGraphics *>( graphics );
 
   // This will only be created once
   eglGraphics->Create();
@@ -712,7 +713,7 @@ Dali::DisplayConnection& Adaptor::GetDisplayConnectionInterface()
 GraphicsInterface& Adaptor::GetGraphicsInterface()
 {
   DALI_ASSERT_DEBUG( mGraphics && "Graphics interface not created" );
-  return *mGraphics;
+  return *( mGraphics.get() );
 }
 
 Dali::Integration::PlatformAbstraction& Adaptor::GetPlatformAbstractionInterface()
@@ -803,7 +804,8 @@ Any Adaptor::GetGraphicsDisplay()
 
   if (mGraphics)
   {
-    auto eglGraphics = static_cast<EglGraphics *>( mGraphics ); // This interface is temporary until Core has been updated to match
+    GraphicsInterface* graphics = mGraphics.get(); // This interface is temporary until Core has been updated to match
+    auto eglGraphics = static_cast<EglGraphics *>( graphics );
 
     EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
     display = eglImpl.GetDisplay();
index d0d2379..9e4c079 100755 (executable)
@@ -664,7 +664,7 @@ private: // Data
   Dali::Integration::Core*              mCore;                        ///< Dali Core
   ThreadController*                     mThreadController;            ///< Controls the threads
 
-  GraphicsInterface*                    mGraphics;                    ///< Graphics interface
+  std::unique_ptr< GraphicsInterface >  mGraphics;                    ///< Graphics interface
   Dali::DisplayConnection*              mDisplayConnection;           ///< Display connection
   WindowContainer                       mWindows;                     ///< A container of all the Windows that are currently created
 
index 7343b43..5c5840a 100644 (file)
@@ -794,7 +794,7 @@ void CombinedUpdateRenderController::UpdateRenderThread()
     }
   }
 
-  // Inform core of context destruction & shutdown EGL
+  // Inform core of context destruction
   mCore.ContextDestroyed();
   currentSurface = mAdaptorInterfaces.GetRenderSurfaceInterface();
   if( currentSurface )
@@ -803,6 +803,9 @@ void CombinedUpdateRenderController::UpdateRenderThread()
     currentSurface = nullptr;
   }
 
+  // Shutdown EGL
+  eglInterface->TerminateGles();
+
   LOG_UPDATE_RENDER( "THREAD DESTROYED" );
 
   // Uninstall the logging function
index 5e80ef7..93c1b2f 100644 (file)
@@ -48,6 +48,11 @@ public:
   };
 
   /**
+   * Destructor
+   */
+  virtual ~GraphicsInterface() {}
+
+  /**
    * Initialize the graphics interface
    * @param[in]  environmentOptions  The environment options.
    */
@@ -76,12 +81,6 @@ public:
     return mStencilBufferRequired;
   };
 
-protected:
-  /**
-   * Virtual protected destructor - no deletion through this interface
-   */
-  virtual ~GraphicsInterface() {};
-
 
 protected: