From: Sangyoon Jang Date: Thu, 4 Jun 2020 09:29:25 +0000 (+0900) Subject: Fix move constructor X-Git-Tag: accepted/tizen/unified/20200610.140852~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89f019466c926c58bc0429ba62a0b2f7dfc704af;p=platform%2Fcore%2Fbase%2Fbundle.git Fix move constructor Move impl_ instance instead create new one. Change-Id: I590ac591ff463fc6f0945eb6691313da180a738f Signed-off-by: Sangyoon Jang --- diff --git a/src/bundle_cpp.cc b/src/bundle_cpp.cc index 34c8a21..2d3233a 100644 --- a/src/bundle_cpp.cc +++ b/src/bundle_cpp.cc @@ -70,7 +70,7 @@ Bundle::Bundle(bundle* b, bool copy, bool own) } Bundle::~Bundle() { - if (impl_->handle_ && (impl_->own_ || impl_->copy_)) + if (impl_ && impl_->handle_ && (impl_->own_ || impl_->copy_)) bundle_free(impl_->handle_); } @@ -158,9 +158,8 @@ Bundle& Bundle::operator = (const Bundle& b) { } Bundle::Bundle(Bundle&& b) noexcept { - impl_ = std::unique_ptr(new Impl(this)); - impl_->handle_ = b.impl_->handle_; - b.impl_->handle_ = nullptr; + impl_ = std::move(b.impl_); + impl_->parent_ = this; } Bundle& Bundle::operator = (Bundle&& b) noexcept {