change setData() attitude with the internal data object
- when takeOwnership is false, instead of deleting the old object and generating a new object from scratch, it clears now the old object
This commit is contained in:
parent
a704ee046a
commit
96eae4f957
1 changed files with 8 additions and 8 deletions
|
@ -939,6 +939,7 @@ inline void RagePhoto::setBufferOffsets(RagePhotoData *ragePhotoData)
|
||||||
|
|
||||||
bool RagePhoto::setData(RagePhotoData *ragePhotoData, bool takeOwnership)
|
bool RagePhoto::setData(RagePhotoData *ragePhotoData, bool takeOwnership)
|
||||||
{
|
{
|
||||||
|
if (takeOwnership) {
|
||||||
std::free(m_data->jpeg);
|
std::free(m_data->jpeg);
|
||||||
std::free(m_data->description);
|
std::free(m_data->description);
|
||||||
std::free(m_data->json);
|
std::free(m_data->json);
|
||||||
|
@ -946,11 +947,10 @@ bool RagePhoto::setData(RagePhotoData *ragePhotoData, bool takeOwnership)
|
||||||
std::free(m_data->title);
|
std::free(m_data->title);
|
||||||
delete m_data;
|
delete m_data;
|
||||||
|
|
||||||
if (takeOwnership) {
|
|
||||||
m_data = ragePhotoData;
|
m_data = ragePhotoData;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_data = new RagePhotoData { 0 };
|
clear();
|
||||||
|
|
||||||
m_data->photoFormat = ragePhotoData->photoFormat;
|
m_data->photoFormat = ragePhotoData->photoFormat;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue