FramesData: Don't leak allocated frames, and remove unused functions
Valgrind report: ``` 14,960 (11,544 direct, 3,416 indirect) bytes in 37 blocks are definitely lost in loss record 20,483 of 20,540 at 0x4837DEF: operator new(unsigned long) (vg_replace_malloc.c:334) by 0xC06963: rtengine::FramesData::FramesData(Glib::ustring const&, std::unique_ptr<rtengine::RawMetaDataLocation, std::default_delete<rtengine::RawMetaDataLocation> >, bool) (imagedata.cc:1121) by 0xBD774F: rtengine::DFManager::addFileInfo(Glib::ustring const&, bool) (dfmanager.cc:380) by 0xBD6E90: rtengine::DFManager::init(Glib::ustring) (dfmanager.cc:303) by 0xC3EC5D: rtengine::init(rtengine::Settings const*, Glib::ustring, Glib::ustring, bool) [clone ._omp_fn.0] (init.cc:93) by 0x897CABD: gomp_thread_start (team.c:120) by 0x89B7A9C: start_thread (in /usr/lib/libpthread-2.28.so) by 0x8ACCB22: clone (in /usr/lib/libc-2.28.so) ```
This commit is contained in:
@@ -809,11 +809,6 @@ unsigned int FramesData::getFrameCount () const
|
||||
return dcrawFrameCount ? dcrawFrameCount : frames.size();
|
||||
}
|
||||
|
||||
FrameData *FramesData::getFrameData (unsigned int frame) const
|
||||
{
|
||||
return frames.empty() || frame >= frames.size() ? nullptr : frames.at(frame);
|
||||
}
|
||||
|
||||
bool FramesData::getPixelShift () const
|
||||
{
|
||||
// So far only Pentax and Sony provide multi-frame Pixel Shift files.
|
||||
@@ -1118,9 +1113,7 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr<RawMetaDataL
|
||||
|
||||
// creating FrameData
|
||||
for (auto currFrame : exifManager.frames) {
|
||||
FrameData* fd = new FrameData(currFrame, currFrame->getRoot(), roots.at(0));
|
||||
|
||||
frames.push_back(fd);
|
||||
frames.push_back(std::unique_ptr<FrameData>(new FrameData(currFrame, currFrame->getRoot(), roots.at(0))));
|
||||
}
|
||||
for (auto currRoot : roots) {
|
||||
rtexif::Tag* t = currRoot->getTag(0x83BB);
|
||||
@@ -1142,8 +1135,7 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr<RawMetaDataL
|
||||
exifManager.parseJPEG ();
|
||||
roots = exifManager.roots;
|
||||
for (auto currFrame : exifManager.frames) {
|
||||
FrameData* fd = new FrameData(currFrame, currFrame->getRoot(), roots.at(0));
|
||||
frames.push_back(fd);
|
||||
frames.push_back(std::unique_ptr<FrameData>(new FrameData(currFrame, currFrame->getRoot(), roots.at(0))));
|
||||
}
|
||||
rewind (exifManager.f); // Not sure this is necessary
|
||||
iptc = iptc_data_new_from_jpeg_file (exifManager.f);
|
||||
@@ -1161,9 +1153,7 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr<RawMetaDataL
|
||||
|
||||
// creating FrameData
|
||||
for (auto currFrame : exifManager.frames) {
|
||||
FrameData* fd = new FrameData(currFrame, currFrame->getRoot(), roots.at(0));
|
||||
|
||||
frames.push_back(fd);
|
||||
frames.push_back(std::unique_ptr<FrameData>(new FrameData(currFrame, currFrame->getRoot(), roots.at(0))));
|
||||
}
|
||||
for (auto currRoot : roots) {
|
||||
rtexif::Tag* t = currRoot->getTag(0x83BB);
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#define __IMAGEDATA_H__
|
||||
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include "rawimage.h"
|
||||
#include <string>
|
||||
#include <glibmm.h>
|
||||
@@ -89,7 +90,7 @@ public:
|
||||
class FramesData : public FramesMetaData {
|
||||
private:
|
||||
// frame's root IFD, can be a file root IFD or a SUB-IFD
|
||||
std::vector<FrameData*> frames;
|
||||
std::vector<std::unique_ptr<FrameData>> frames;
|
||||
// root IFD in the file
|
||||
std::vector<rtexif::TagDirectory*> roots;
|
||||
IptcData* iptc;
|
||||
@@ -102,7 +103,6 @@ public:
|
||||
void setDCRawFrameCount (unsigned int frameCount);
|
||||
unsigned int getRootCount () const;
|
||||
unsigned int getFrameCount () const;
|
||||
FrameData *getFrameData (unsigned int frame) const;
|
||||
bool getPixelShift () const;
|
||||
bool getHDR (unsigned int frame = 0) const;
|
||||
std::string getImageType (unsigned int frame) const;
|
||||
|
@@ -110,7 +110,6 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual FrameData* getImageData (unsigned int frameNum) = 0;
|
||||
virtual ImageMatrices* getImageMatrices () = 0;
|
||||
virtual bool isRAW () const = 0;
|
||||
virtual DCPProfile* getDCP (const ColorManagementParams &cmp, DCPProfile::ApplyState &as)
|
||||
|
@@ -168,10 +168,6 @@ public:
|
||||
return ri->get_rotateDegree();
|
||||
}
|
||||
|
||||
FrameData* getImageData (unsigned int frameNum)
|
||||
{
|
||||
return idata->getFrameData (frameNum);
|
||||
}
|
||||
ImageMatrices* getImageMatrices ()
|
||||
{
|
||||
return &imatrices;
|
||||
|
@@ -69,10 +69,6 @@ public:
|
||||
void getFullSize (int& w, int& h, int tr = TR_NONE);
|
||||
void getSize (const PreviewProps &pp, int& w, int& h);
|
||||
|
||||
FrameData* getImageData (unsigned int frameNum)
|
||||
{
|
||||
return idata->getFrameData (frameNum);
|
||||
}
|
||||
ImageIO* getImageIO ()
|
||||
{
|
||||
return img;
|
||||
|
Reference in New Issue
Block a user