Fix large memory leak when using inspector on raw files without embedded jpg
This commit is contained in:
parent
18076077c0
commit
31d1f2f52b
@ -99,7 +99,6 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext
|
|||||||
int error = rawImage.load(fname, true);
|
int error = rawImage.load(fname, true);
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
rtengine::Image8 *output = nullptr;
|
|
||||||
const unsigned char *data = nullptr;
|
const unsigned char *data = nullptr;
|
||||||
int fw, fh;
|
int fw, fh;
|
||||||
|
|
||||||
@ -114,27 +113,27 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext
|
|||||||
params.raw.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast];
|
params.raw.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast];
|
||||||
rawImage.preprocess(params.raw, params.lensProf, params.coarse);
|
rawImage.preprocess(params.raw, params.lensProf, params.coarse);
|
||||||
rawImage.demosaic(params.raw);
|
rawImage.demosaic(params.raw);
|
||||||
Imagefloat* image = new rtengine::Imagefloat (fw, fh);
|
Imagefloat image(fw, fh);
|
||||||
rawImage.getImage (wb, TR_NONE, image, pp, params.toneCurve, params.icm, params.raw);
|
rawImage.getImage (wb, TR_NONE, &image, pp, params.toneCurve, params.icm, params.raw);
|
||||||
output = new Image8(fw, fh);
|
rtengine::Image8 output(fw, fh);
|
||||||
rawImage.convertColorSpace(image, params.icm, wb);
|
rawImage.convertColorSpace(&image, params.icm, wb);
|
||||||
#pragma omp parallel for schedule(dynamic, 10)
|
#pragma omp parallel for schedule(dynamic, 10)
|
||||||
for (int i = 0; i < fh; ++i)
|
for (int i = 0; i < fh; ++i)
|
||||||
for (int j = 0; j < fw; ++j) {
|
for (int j = 0; j < fw; ++j) {
|
||||||
image->r(i, j) = Color::gamma2curve[image->r(i, j)];
|
image.r(i, j) = Color::gamma2curve[image.r(i, j)];
|
||||||
image->g(i, j) = Color::gamma2curve[image->g(i, j)];
|
image.g(i, j) = Color::gamma2curve[image.g(i, j)];
|
||||||
image->b(i, j) = Color::gamma2curve[image->b(i, j)];
|
image.b(i, j) = Color::gamma2curve[image.b(i, j)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
image->resizeImgTo<Image8>(fw, fh, TI_Nearest, output);
|
image.resizeImgTo<Image8>(fw, fh, TI_Nearest, &output);
|
||||||
data = output->getData();
|
data = output.getData();
|
||||||
|
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
int w, h;
|
int w, h;
|
||||||
w = output->getWidth();
|
w = output.getWidth();
|
||||||
h = output->getHeight();
|
h = output.getHeight();
|
||||||
previewImage = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, w, h);
|
previewImage = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, w, h);
|
||||||
previewImage->flush();
|
previewImage->flush();
|
||||||
|
|
||||||
@ -152,10 +151,6 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output) {
|
|
||||||
delete output;
|
|
||||||
}
|
|
||||||
|
|
||||||
previewImage->mark_dirty();
|
previewImage->mark_dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user