forked from enlightenment/efl
eo-cxx: Fix possible non-initialization in copy-constructor and move-constructor
This commit is contained in:
parent
6ded80a9b5
commit
b5c4aeab94
|
@ -72,6 +72,7 @@ struct concrete
|
||||||
}
|
}
|
||||||
|
|
||||||
concrete(concrete const& other)
|
concrete(concrete const& other)
|
||||||
|
: _eo_raw(nullptr)
|
||||||
{
|
{
|
||||||
if(other._eo_raw)
|
if(other._eo_raw)
|
||||||
_eo_raw = detail::ref(other._eo_raw);
|
_eo_raw = detail::ref(other._eo_raw);
|
||||||
|
@ -94,17 +95,15 @@ struct concrete
|
||||||
}
|
}
|
||||||
if(other._eo_raw)
|
if(other._eo_raw)
|
||||||
_eo_raw = detail::ref(other._eo_raw);
|
_eo_raw = detail::ref(other._eo_raw);
|
||||||
|
else
|
||||||
|
_eo_raw = nullptr;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
concrete& operator=(concrete&& other)
|
concrete& operator=(concrete&& other)
|
||||||
{
|
{
|
||||||
if(_eo_raw)
|
concrete tmp(other);
|
||||||
{
|
std::swap(*this, tmp);
|
||||||
detail::unref(_eo_raw);
|
|
||||||
_eo_raw = nullptr;
|
|
||||||
}
|
|
||||||
std::swap(_eo_raw, other._eo_raw);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue