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,18 +939,18 @@ inline void RagePhoto::setBufferOffsets(RagePhotoData *ragePhotoData)
|
||||||
|
|
||||||
bool RagePhoto::setData(RagePhotoData *ragePhotoData, bool takeOwnership)
|
bool RagePhoto::setData(RagePhotoData *ragePhotoData, bool takeOwnership)
|
||||||
{
|
{
|
||||||
std::free(m_data->jpeg);
|
|
||||||
std::free(m_data->description);
|
|
||||||
std::free(m_data->json);
|
|
||||||
std::free(m_data->header);
|
|
||||||
std::free(m_data->title);
|
|
||||||
delete m_data;
|
|
||||||
|
|
||||||
if (takeOwnership) {
|
if (takeOwnership) {
|
||||||
|
std::free(m_data->jpeg);
|
||||||
|
std::free(m_data->description);
|
||||||
|
std::free(m_data->json);
|
||||||
|
std::free(m_data->header);
|
||||||
|
std::free(m_data->title);
|
||||||
|
delete m_data;
|
||||||
|
|
||||||
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