Fix the bug system initailize and shutdown pair. 44/295044/2
authorWonsik Jung <sidein@samsung.com>
Fri, 30 Jun 2023 09:16:47 +0000 (18:16 +0900)
committerWonsik Jung <sidein@samsung.com>
Mon, 3 Jul 2023 06:18:58 +0000 (15:18 +0900)
This patch is to fix the bug system initailize and shutdown pair.
Sometimes,  WindowSystem::Shutdown() is called before WindowSystem::Initialize() is not calling.
The example is the below.
int UtcDaliApplicationNew01(void)
{
  Application application = Application::New();

  MyTestApp testApp(application);

  DALI_TEST_CHECK(application);

  END_TEST;
}

Change-Id: Icf3c19757bdc2b772bdc8fdd6ef1b67eba3f2c8b

dali/internal/adaptor/common/application-impl.cpp
dali/internal/adaptor/common/application-impl.h

index 3efd7a5..d81c67b 100644 (file)
@@ -111,6 +111,7 @@ Application::Application(int* argc, char** argv[], const std::string& stylesheet
   mLaunchpadState(Launchpad::NONE),
   mDefaultWindowType(windowData.GetWindowType()),
   mUseUiThread(useUiThread),
+  mIsSystemInitialized(false),
   mSlotDelegate(this)
 {
   // Set mName from command-line args
@@ -151,7 +152,10 @@ Application::~Application()
   {
     delete mAdaptor;
     delete mAdaptorBuilder;
-    WindowSystem::Shutdown();
+    if(mIsSystemInitialized)
+    {
+      WindowSystem::Shutdown();
+    }
   }
 }
 
@@ -213,6 +217,7 @@ void Application::CreateWindow()
   windowData.SetWindowType(mDefaultWindowType);
 
   WindowSystem::Initialize();
+  mIsSystemInitialized = true;
 
   if(mLaunchpadState != Launchpad::PRE_INITIALIZED)
   {
index ab1b2e8..8127322 100644 (file)
@@ -540,6 +540,7 @@ private:
   WindowType       mDefaultWindowType; ///< Default window's type. It is used when Application is created.
   bool             mUseRemoteSurface;
   bool             mUseUiThread;
+  bool             mIsSystemInitialized;
 
   SlotDelegate<Application> mSlotDelegate;