fix failing tests: 2 incorrect test cases 1 memory leak in dali core 08/30308/4
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Fri, 14 Nov 2014 10:14:01 +0000 (10:14 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Fri, 14 Nov 2014 11:32:30 +0000 (03:32 -0800)
[Problem]
[Cause]
[Solution]

Change-Id: I0b5196756ce3716013eb944c955e7d51cdf4469c

automated-tests/src/dali/utc-Dali-ShaderEffect.cpp
automated-tests/src/dali/utc-Dali-SignalTemplatesV2.cpp
dali/public-api/signals/connection-tracker-interface.h
dali/public-api/signals/signal-slot-connections.cpp

index 1fa2684..ea20a92 100644 (file)
@@ -516,7 +516,10 @@ int UtcDaliShaderEffectMethodSetEffectImage(void)
   application.Render(16);
   application.SendNotification();
 
-  DALI_TEST_CHECK( application.GetGlAbstraction().CheckUniformValue( "sEffect", 1 ) );
+  GLuint programId, uniformId;
+  bool uniformWasSet = application.GetGlAbstraction().GetUniformIds( "sEffect", programId, uniformId );
+  // we dont care about the value of the sampler uniform as thats internal to DALi core and subject to change
+  DALI_TEST_CHECK( uniformWasSet );
   END_TEST;
 }
 
index 99bdab8..25098cd 100644 (file)
@@ -823,11 +823,11 @@ public:
 
   ~TestBasicConnectionTrackerInterface()
   {
-    if( mCallback )
+    if( mSlotObserver && mCallback )
     {
       // Notify signal since the slot has been destroyed
       mSlotObserver->SlotDisconnected( mCallback );
-      delete mCallback;
+      // mCallback and mSlotObserver are not owned
     }
   }
 
@@ -871,9 +871,8 @@ public:
     if( mSlotObserver == slotObserver )
     {
       mSlotObserver = NULL;
-
-      delete mCallback;
       mCallback = NULL;
+      // mCallback and mSlotObserver are not owned
     }
   }
 
index cf011f0..a113407 100644 (file)
@@ -63,8 +63,8 @@ public:
   /**
    * @brief Called when a signal is connected.
    *
-   * @param[in] slotObserver The slot observer i.e. a signal.
-   * @param[in] callback The call back.
+   * @param[in] slotObserver The slot observer i.e. a signal. Ownership is not passed.
+   * @param[in] callback The call back. Ownership is not passed.
    */
   virtual void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) = 0;
 
index ab22e09..531d286 100644 (file)
@@ -71,6 +71,8 @@ void SignalConnection::Disconnect( SlotObserver* slotObserver )
     mSignalObserver = NULL;
   }
 
+  // we own the callback, SignalObserver is expected to delete the SlotConnection on Disconnected so its pointer to our mCallback is no longer used
+  delete mCallback;
   mCallback = NULL;
 }