[UTC][dali-adaptor][Non-ACR][Fix ASAN heap-use-after-free issue] 11/212511/1
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 22 Aug 2019 08:12:30 +0000 (17:12 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 22 Aug 2019 08:12:30 +0000 (17:12 +0900)
Change-Id: Idc075f4a7c87bfc745b886207ab3caaf620371ab

src/utc/dali-adaptor/window/utc-dali-window.cpp

index f226b37605929b8dcea4200de4d7031a643e6a54..4330f7a18c5d7ad22ac70e70be12f09dbbc098e3 100755 (executable)
@@ -31,10 +31,10 @@ void utc_Dali_Window_cleanup(void)
 }
 
 void WindowIndicatorVisibilityChangedSignalP(Application& mApplication);
-void WindowNewP();
-void WindowNewP2();
+void WindowNewP( Window& newWindow );
+void WindowNewP2( Window& newWindow );
 void WindowCheckConstructorP();
-void WindowCheckCopyConstructorP();
+void WindowCheckCopyConstructorP( Window& newWindow );
 void WindowCheckSetClassP(Application& mApplication);
 void WindowConstructorNewAssignmentOperatorP(Application& mApplication);
 void WindowSetPreferredOrientationP(Application& mApplication);
@@ -137,7 +137,8 @@ namespace
   {
     Window_TestApp( Application& app, int test_case )
       : mApplication( app ),
-      mTestCase( test_case )
+      mTestCase( test_case ),
+      mNewWindow()
     {
       mApplication.InitSignal().Connect( this, &Window_TestApp::OnInit );
     }
@@ -178,11 +179,11 @@ namespace
           break;
 
         case WINDOW_NEW_P:
-          WindowNewP();
+          WindowNewP( mNewWindow );
           break;
 
         case WINDOW_NEW_P2:
-          WindowNewP2();
+          WindowNewP2( mNewWindow );
           break;
 
         case WINDOW_CONSTRUCTOR_P:
@@ -190,7 +191,7 @@ namespace
           break;
 
         case WINDOW_COPY_CONSTRUCTOR_P:
-          WindowCheckCopyConstructorP();
+          WindowCheckCopyConstructorP( mNewWindow );
           break;
 
         case WINDOW_SET_CLASS_P:
@@ -327,6 +328,7 @@ namespace
     Application& mApplication;
     int mTestCase;
     Timer mTimer;
+    Window mNewWindow;
   };
 
 } // unnamed namespace
@@ -340,22 +342,21 @@ void WindowCheckConstructorP()
 
 }
 
-void WindowCheckCopyConstructorP()
+void WindowCheckCopyConstructorP( Window& newWindow )
 {
 
   try
   {
-    PositionSize windowPosition(0, 0, 1, 1);
-    Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
-    DALI_CHECK_FAIL(!window,"Window::New is failed to create initialized window object");
+    PositionSize windowPosition( 0, 0, 1, 1 );
+    newWindow = Dali::Window::New( windowPosition, "test-window", true );
+    DALI_CHECK_FAIL( !newWindow, "Window::New is failed to create initialized window object" );
 
-    Dali::Window copy( window );
-    DALI_CHECK_FAIL( copy != window, "Window::CheckCopyConstructor is failed" );
+    Dali::Window copy( newWindow );
+    DALI_CHECK_FAIL( copy != newWindow, "Window::CheckCopyConstructor is failed" );
   }
   catch ( DaliException& e )
   {
-    DALI_CHECK_FAIL(true,"Window::New is failed to create initialized window object");
-
+    DALI_CHECK_FAIL( true, "Window::New is failed to create initialized window object" );
   }
 
   DaliLog::PrintPass();
@@ -400,33 +401,33 @@ void WindowConstructorNewAssignmentOperatorP(Application& mApplication)
   DaliLog::PrintPass();
 }
 
-void WindowNewP()
+void WindowNewP( Window& newWindow )
 {
   try
   {
-    PositionSize windowPosition(0, 0, 1, 1);
-    Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
-    DALI_CHECK_FAIL(!window,"Window::New is failed to create initialized window object");
+    PositionSize windowPosition( 0, 0, 1, 1 );
+    newWindow = Dali::Window::New( windowPosition, "test-window", true );
+    DALI_CHECK_FAIL( !newWindow, "Window::New is failed to create initialized window object" );
   }
   catch ( DaliException& e )
   {
-    DALI_CHECK_FAIL(true,"Window::New is failed to create initialized window object");
+    DALI_CHECK_FAIL( true,"Window::New is failed to create initialized window object" );
   }
 
   DaliLog::PrintPass();
 }
 
-void WindowNewP2()
+void WindowNewP2( Window& newWindow )
 {
   try
   {
-    PositionSize windowPosition(0, 0, 1, 1);
-    Dali::Window window = Dali::Window::New( windowPosition, "test-window", "test-window-class", true );
-    DALI_CHECK_FAIL(!window,"Window::New is failed to create initialized window object");
+    PositionSize windowPosition( 0, 0, 1, 1 );
+    newWindow = Dali::Window::New( windowPosition, "test-window", "test-window-class", true );
+    DALI_CHECK_FAIL( !newWindow, "Window::New is failed to create initialized window object" );
   }
   catch ( DaliException& e )
   {
-    DALI_CHECK_FAIL(true,"Window::New is failed to create initialized window object");
+    DALI_CHECK_FAIL( true, "Window::New is failed to create initialized window object" );
   }
 
   DaliLog::PrintPass();