Fix a recursive Mutex lock bug when selecting an output Gamma profile.

This commit is contained in:
Hombre
2016-09-11 03:49:33 +02:00
parent a9fc506ac9
commit ee4749f271
2 changed files with 6 additions and 2 deletions

View File

@@ -434,6 +434,7 @@ void ICCStore::getGammaArray(const procparams::ColorManagementParams &icm, Gamma
}
}
// WARNING: the caller must lock lcmsMutex
cmsHPROFILE ICCStore::createGammaProfile (const procparams::ColorManagementParams &icm, GammaValues &ga) {
float p[6]; //primaries
ga[6] = 0.0;
@@ -519,16 +520,17 @@ cmsHPROFILE ICCStore::createGammaProfile (const procparams::ColorManagementParam
// 7 parameters for smoother curves
cmsFloat64Number Parameters[7] = { ga[0], ga[1], ga[2], ga[3], ga[4], ga[5], ga[6] } ;
lcmsMutex->lock ();
//lcmsMutex->lock (); Mutex acquired by the caller
cmsWhitePointFromTemp(&xyD, (double)temp);
GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, 5, Parameters); //5 = smoother than 4
cmsHPROFILE oprofdef = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC); //oprofdef become Outputprofile
cmsFreeToneCurve(GammaTRC[0]);
lcmsMutex->unlock ();
//lcmsMutex->unlock ();
return oprofdef;
}
// WARNING: the caller must lock lcmsMutex
cmsHPROFILE ICCStore::createCustomGammaOutputProfile (const procparams::ColorManagementParams &icm, GammaValues &ga) {
bool pro = false;
Glib::ustring outProfile;

View File

@@ -305,8 +305,10 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int
cmsHPROFILE oprof = NULL;
if (ga) {
lcmsMutex->lock ();
iccStore->getGammaArray(icm, *ga);
oprof = iccStore->createGammaProfile(icm, *ga);
lcmsMutex->unlock ();
printf("iccStore->createGammaProfile(icm, *ga);\n");
} else {
oprof = iccStore->getProfile (icm.output);