Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 3929649e authored by Jouni Pentikäinen's avatar Jouni Pentikäinen

Fix failure handling when saving reference images

BUG: 396143
parent e0cede28
......@@ -274,16 +274,14 @@ bool KisReferenceImage::saveImage(KoStore *store) const
return false;
}
KoStoreDevice storeDev(store);
if (!storeDev.open(QIODevice::WriteOnly)) {
return false;
}
bool saved = false;
if (!d->image.save(&storeDev, "PNG")) {
return false;
KoStoreDevice storeDev(store);
if (storeDev.open(QIODevice::WriteOnly)) {
saved = d->image.save(&storeDev, "PNG");
}
return store->close();
return store->close() && saved;
}
bool KisReferenceImage::loadImage(KoStore *store)
......
......@@ -94,10 +94,15 @@ bool KisKraSaveVisitor::visit(KisExternalLayer * layer)
{
bool result = false;
if (auto* referencesLayer = dynamic_cast<KisReferenceImagesLayer*>(layer)) {
result = true;
Q_FOREACH(KoShape *shape, referencesLayer->shapes()) {
auto *reference = dynamic_cast<KisReferenceImage*>(shape);
KIS_ASSERT_RECOVER_RETURN_VALUE(reference, false);
reference->saveImage(m_store);
bool saved = reference->saveImage(m_store);
if (!saved) {
m_errorMessages << i18n("Failed to save reference image %1.", reference->url());
result = false;
}
}
}
else if (KisShapeLayer *shapeLayer = dynamic_cast<KisShapeLayer*>(layer)) {
......
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