If Reset() is called somewhere, there is no way to check whether this WeakHandle is still valid. Attempts of calling GetBaseHandle() or operator ==, != will crash.
Change-Id: I161af6539f2a9ab971a55f0e1280ed890cd98715
END_TEST;
}
+int UtcDaliWeakHandleBaseReset(void)
+{
+ TestApplication application;
+ tet_infoline( "Testing Daku::WeakHandleBase::Reset()" );
+
+ Actor actor = Actor::New();
+ WeakHandleBase object(actor);
+ DALI_TEST_CHECK(object.GetBaseHandle() == actor);
+
+ object.Reset();
+
+ DALI_TEST_CHECK(object == WeakHandleBase());
+ DALI_TEST_CHECK(object.GetBaseHandle() == Handle());
+
+ END_TEST;
+}
+
int UtcDaliWeakHandleGetHandle(void)
{
TestApplication application;
// Destruction
~Impl()
{
+ Reset();
+ }
+
+ void Reset()
+ {
if( mObject )
{
mObject->RemoveObserver( *this );
+ mObject = NULL;
}
}
void WeakHandleBase::Reset()
{
- delete mImpl;
- mImpl = NULL;
+ mImpl->Reset();
}