Revert "[Tizen] Add GlWindow"
[platform/core/uifw/dali-adaptor.git] / dali / internal / offscreen / common / offscreen-application-impl.cpp
index 254f42f..396dbc4 100644 (file)
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/adaptor-framework/native-render-surface.h>
 
-using Dali::Internal::Adaptor::ThreadMode;
-using RenderMode = Dali::OffscreenApplication::RenderMode;
-
 namespace Dali
 {
 
 namespace Internal
 {
 
+using RenderMode = Dali::OffscreenApplication::RenderMode;
+
 IntrusivePtr< OffscreenApplication > OffscreenApplication::New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, RenderMode renderMode )
 {
   IntrusivePtr< OffscreenApplication > offscreenApplication = new OffscreenApplication( width, height, surface, isTranslucent, renderMode );
@@ -47,8 +46,7 @@ OffscreenApplication::OffscreenApplication( uint16_t width, uint16_t height, Dal
   mDefaultWindow = Dali::OffscreenWindow( impl.Get() );
 
   mAdaptor.reset( Dali::Internal::Adaptor::Adaptor::New( Dali::Integration::SceneHolder( impl.Get() ), impl->GetSurface(), NULL,
-                            renderMode == RenderMode::AUTO ?
-                            Dali::Internal::Adaptor::ThreadMode::NORMAL : Dali::Internal::Adaptor::ThreadMode::RUN_IF_REQUESTED ) );
+                            renderMode == RenderMode::AUTO ? Dali::Internal::Adaptor::ThreadMode::NORMAL : Dali::Internal::Adaptor::ThreadMode::RUN_IF_REQUESTED ) );
 
   // Initialize default window
   impl->Initialize( true );
@@ -56,16 +54,20 @@ OffscreenApplication::OffscreenApplication( uint16_t width, uint16_t height, Dal
 
 void OffscreenApplication::Start()
 {
-   // Start the adaptor
-   mAdaptor->Start();
-   mInitSignal.Emit();
-   mAdaptor->NotifySceneCreated();
+  // Start the adaptor
+  mAdaptor->Start();
+
+  Dali::OffscreenApplication handle( this );
+  mInitSignal.Emit();
+  mAdaptor->NotifySceneCreated();
 }
 
 void OffscreenApplication::Stop()
 {
   // Stop the adaptor
   mAdaptor->Stop();
+
+  Dali::OffscreenApplication handle( this );
   mTerminateSignal.Emit();
 }