Fixes double free or corruption (out) when using Noise Reduction, Issue 1887

This commit is contained in:
Ingo 2013-05-28 15:37:05 +02:00
parent 3c0254987c
commit 31b2bb9100

View File

@ -258,7 +258,10 @@ namespace rtengine {
// Calculate number of tiles. If less than omp_get_max_threads(), then limit num_threads to number of tiles
int numtiles = numtiles_W * numtiles_H;
int numthreads = MIN(numtiles,omp_get_max_threads());
if(options.rgbDenoiseThreadLimit > 0) numthreads = MIN(numthreads,options.rgbDenoiseThreadLimit);
if(options.rgbDenoiseThreadLimit > 0) numthreads = MIN(numthreads,options.rgbDenoiseThreadLimit);
// Issue 1887, overide setting of 1, if more than one thread is available. This way the inner omp-directives should become inactive
if(numthreads == 1 && omp_get_max_threads() > 1)
numthreads = 2;
#pragma omp parallel num_threads(numthreads)
#endif
{