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++

Check for export status of every animation frame and error out on QFile::copy failure

Raidon Chrome665c91ada4f9
diff --git a/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp b/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp
index 17f7bf65d6..9161b4fcad 100644
--- a/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp
+++ b/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp
@@ -105,24 +105,29 @@ void KisAsyncAnimationFramesSavingRenderer::frameCompletedCallback(int frame, co
}
//Get all identical frames to this one and either copy or symlink based on settings.
- KisTimeSpan identicals = KisTimeSpan::calculateIdenticalFramesRecursive(image->root(), frame);
- identicals &= m_d->range;
- if( !m_d->onlyNeedsUniqueFrames && identicals.start() < identicals.end() ) {
- for (int identicalFrame = (identicals.start() + 1); identicalFrame <= identicals.end(); identicalFrame++) {
- QString identicalFrameNumber = QString("%1").arg(identicalFrame + m_d->sequenceNumberingOffset, 4, 10, QChar('0'));
- QString identicalFrameName = m_d->filenamePrefix + identicalFrameNumber + m_d->filenameSuffix;
-
- QFile::copy(filename, identicalFrameName);
-
- /* This would be nice to do but sym-linking on windows isn't possible without
- * way more other work to be done. This works on linux though!
- *
- * if (m_d->linkRedundantFrames) {
- * QFile::link(filename, identicalFrameName);
- * } else {
- * QFile::copy(filename, identicalFrameName);
- * }
- */
+ if (status.isOk()) {
+ KisTimeSpan identicals = KisTimeSpan::calculateIdenticalFramesRecursive(image->root(), frame);
+ identicals &= m_d->range;
+ if( !m_d->onlyNeedsUniqueFrames && identicals.start() < identicals.end() ) {
+ for (int identicalFrame = (identicals.start() + 1); identicalFrame <= identicals.end(); identicalFrame++) {
+ QString identicalFrameNumber = QString("%1").arg(identicalFrame + m_d->sequenceNumberingOffset, 4, 10, QChar('0'));
+ QString identicalFrameName = m_d->filenamePrefix + identicalFrameNumber + m_d->filenameSuffix;
+
+ if (!QFile::copy(filename, identicalFrameName)) {
+ status = ImportExportCodes::ErrorWhileWriting;
+ break;
+ }
+
+ /* This would be nice to do but sym-linking on windows isn't possible without
+ * way more other work to be done. This works on linux though!
+ *
+ * if (m_d->linkRedundantFrames) {
+ * QFile::link(filename, identicalFrameName);
+ * } else {
+ * QFile::copy(filename, identicalFrameName);
+ * }
+ */
+ }
}
}