Commit ca4f1cf4 authored by Halla Rempt's avatar Halla Rempt

Don't try to set an invalid profile on the image.

CCBUG:305523

There's still a crash happening later on :-(
parent 842bc249
......@@ -135,26 +135,24 @@ KisImageWSP KisKraLoader::loadXML(const KoXmlElement& element)
}
profileProductName = element.attribute(PROFILE);
// A hack for an old colorspacename
if (colorspacename == "Grayscale + Alpha") {
colorspacename = "GRAYA";
profileProductName = QString();
profileProductName = QString::null;
}
if (colorspacename == "RgbAF32") {
colorspacename = "RGBAF32";
profileProductName = QString();
profileProductName = QString::null;
}
if (colorspacename == "RgbAF16") {
colorspacename = "RGBAF32";
profileProductName = QString();
profileProductName = QString::null;
}
QString colorspaceModel = KoColorSpaceRegistry::instance()->colorSpaceColorModelId(colorspacename).id();
QString colorspaceDepth = KoColorSpaceRegistry::instance()->colorSpaceColorDepthId(colorspacename).id();
if (profileProductName.isNull()) {
// no mention of profile so get default profile
// no mention of profile so get default profile";
cs = KoColorSpaceRegistry::instance()->colorSpace(colorspaceModel, colorspaceDepth, "");
} else {
cs = KoColorSpaceRegistry::instance()->colorSpace(colorspaceModel, colorspaceDepth, profileProductName);
......@@ -198,10 +196,14 @@ void KisKraLoader::loadBinaryData(KoStore * store, KisImageWSP image, const QStr
QByteArray data; data.resize(store->size());
store->read(data.data(), store->size());
store->close();
image->assignImageProfile(KoColorSpaceRegistry::instance()->createColorProfile(image->colorSpace()->colorModelId().id(), image->colorSpace()->colorDepthId().id(), data));
//if (!data.startsWith("<ctlprofile>"))
const KoColorProfile *profile = KoColorSpaceRegistry::instance()->createColorProfile(image->colorSpace()->colorModelId().id(), image->colorSpace()->colorDepthId().id(), data);
qDebug() << profile->type() << profile->valid();
if (profile->valid()) {
image->assignImageProfile(profile);
}
}
// Load the layers data: if there is a profile associated with a layer it will be set now.
KisKraLoadVisitor visitor(image, store, m_d->layerFilenames, m_d->imageName, m_d->syntaxVersion);
......@@ -210,8 +212,6 @@ void KisKraLoader::loadBinaryData(KoStore * store, KisImageWSP image, const QStr
image->rootLayer()->accept(visitor);
// annotations
// exif
location = external ? QString::null : uri;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment