From: Adeel Kazmi Date: Thu, 24 Nov 2016 17:41:45 +0000 (+0000) Subject: [3.0] Change CustomActorImpl destructor to protected X-Git-Tag: accepted/tizen/3.0/common/20161207.195845~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F100235%2F2;p=platform%2Fcore%2Fuifw%2Fdali-core.git [3.0] Change CustomActorImpl destructor to protected This is a ref-counted object so another non-deriving object should not be able to delete it. Change-Id: Iacca4e57bc7871c33d0c3602051e2980037de20f --- diff --git a/automated-tests/src/dali/utc-Dali-CustomActor.cpp b/automated-tests/src/dali/utc-Dali-CustomActor.cpp index 347ef03..c32c8e7 100644 --- a/automated-tests/src/dali/utc-Dali-CustomActor.cpp +++ b/automated-tests/src/dali/utc-Dali-CustomActor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -823,7 +823,7 @@ int UtcDaliCustomActorImplDestructor(void) { TestApplication application; CustomActorImpl* actor = new Impl::TestCustomActor(); - delete actor; + CustomActor customActor( *actor ); // Will automatically unref at the end of this function DALI_TEST_CHECK( true ); END_TEST; @@ -1747,12 +1747,12 @@ int UtcDaliCustomActorImplOnPropertySet(void) { TestApplication application; CustomActorImpl* impl = new Impl::SimpleTestCustomActor(); + CustomActor customActor( *impl ); // Will automatically unref at the end of this function impl->OnPropertySet( 0, 0 ); DALI_TEST_CHECK( true ); - delete impl; END_TEST; } diff --git a/dali/public-api/actors/custom-actor-impl.cpp b/dali/public-api/actors/custom-actor-impl.cpp index 08022ba..5170eba 100644 --- a/dali/public-api/actors/custom-actor-impl.cpp +++ b/dali/public-api/actors/custom-actor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,6 @@ namespace Dali { -CustomActorImpl::~CustomActorImpl() -{ -} - CustomActor CustomActorImpl::Self() const { return CustomActor(mOwner); @@ -44,6 +40,10 @@ CustomActorImpl::CustomActorImpl( ActorFlags flags ) { } +CustomActorImpl::~CustomActorImpl() +{ +} + void CustomActorImpl::Initialize(Internal::CustomActor& owner) { DALI_ASSERT_DEBUG(mOwner == NULL); // should not already be owned diff --git a/dali/public-api/actors/custom-actor-impl.h b/dali/public-api/actors/custom-actor-impl.h index f1d8ed8..fadf9b5 100644 --- a/dali/public-api/actors/custom-actor-impl.h +++ b/dali/public-api/actors/custom-actor-impl.h @@ -2,7 +2,7 @@ #define __DALI_CUSTOM_ACTOR_IMPL_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,12 +68,6 @@ public: class Extension; ///< Forward declare future extension interface /** - * @brief Virtual destructor - * @SINCE_1_0.0 - */ - virtual ~CustomActorImpl(); - - /** * @brief Used by derived CustomActorImpl instances, to access the public Actor interface. * * @SINCE_1_0.0 @@ -344,6 +338,12 @@ protected: // For derived classes */ CustomActorImpl( ActorFlags flags ); + /** + * @brief Virtual destructor + * @SINCE_1_0.0 + */ + virtual ~CustomActorImpl(); + // Size negotiation helpers /**