Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix a crash by incorrect placement of curve freeing.

Wolthera van Hövell tot Westerflier4900948f7d75
diff --git a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
index 5c7e66b605..1d5f2fd3d8 100644
--- a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
+++ b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.cpp
@@ -139,12 +139,14 @@ IccColorProfile::IccColorProfile(const QVector<double> &colorants,
if (colorants.size() == 2) {
iccProfile = cmsCreateGrayProfile(&whitePoint, mainCurve);
+ // cleanup
+ cmsFreeToneCurve(mainCurve);
} else /*if (colorants.size()>2 || colorPrimariesType != 2)*/ {
// generate rgb profile.
cmsToneCurve *curve[3];
curve[0] = curve[1] = curve[2] = mainCurve;
iccProfile = cmsCreateRGBProfile(&whitePoint, &primaries, curve);
- cmsFreeToneCurve(curve[0]);
+ cmsFreeToneCurve(mainCurve);
}
if (!iccProfile) {
@@ -189,13 +191,12 @@ IccColorProfile::IccColorProfile(const QVector<double> &colorants,
cmsWriteTag(iccProfile, cmsSigCopyrightTag, mlu);
cmsMLUfree (mlu);
+ // Still setting this, as it also writes the non H.273 values.
setCharacteristics(colorPrimariesType, transferFunction);
- // cleanup
- cmsFreeToneCurve(mainCurve);
-
setRawData(LcmsColorProfileContainer::lcmsProfileToByteArray(iccProfile));
cmsCloseProfile(iccProfile);
+
setFileName(name.join(" ").split(" ").join("-")+".icc");
init();
}