Make WeakHandleBase::mImpl as unique_ptr + nullcheck for Reset and comparision 52/319652/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 29 Oct 2024 08:58:23 +0000 (17:58 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 29 Oct 2024 09:34:21 +0000 (18:34 +0900)
commitd006bfac40e999f8dbaddf4781a87319b4057fe6
tree69efdb26f582c809453fecb89f69466139ef6eea
parent1ed6394608c904e37e2f1cf5566d305206372d02
Make WeakHandleBase::mImpl as unique_ptr + nullcheck for Reset and comparision

Until now, WeakHandleBase::Reset() function and == operator
don't check mImpl was nullptr.

But it could be nullptr when we use move operations.

So we should check nullptr before call mImpl->Reset() and operator==.

===

Also, to avoid this kind of leak, let we use std::unique_ptr instead of raw pointer.

Change-Id: Icd0b603b825d6a1f5eb7697466da98af05540b2b
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/utc-Dali-WeakHandle.cpp
dali/public-api/object/weak-handle.cpp
dali/public-api/object/weak-handle.h