Commit d8be8f20 authored by Anna Medonosová's avatar Anna Medonosová

Unlock KisDocument in case of an assert after saving

Adds unlocking of savingMutex to assert recover branches in
KisDocument::slotChildCompletedSavingInBackground.
parent d3c5a3f6
......@@ -996,24 +996,30 @@ bool KisDocument::initiateSavingInBackground(const QString actionName,
void KisDocument::slotChildCompletedSavingInBackground(KisImportExportErrorCode status, const QString &errorMessage)
{
KIS_SAFE_ASSERT_RECOVER(!d->savingMutex.tryLock()) {
KIS_SAFE_ASSERT_RECOVER_RETURN(isSaving());
KIS_SAFE_ASSERT_RECOVER(d->backgroundSaveDocument) {
d->savingMutex.unlock();
return;
}
KIS_SAFE_ASSERT_RECOVER_RETURN(d->backgroundSaveDocument);
if (d->backgroundSaveJob.flags & KritaUtils::SaveInAutosaveMode) {
d->backgroundSaveDocument->d->isAutosaving = false;
}
d->backgroundSaveDocument.take()->deleteLater();
d->savingMutex.unlock();
KIS_SAFE_ASSERT_RECOVER_RETURN(d->backgroundSaveJob.isValid());
KIS_SAFE_ASSERT_RECOVER(d->backgroundSaveJob.isValid()) {
d->savingMutex.unlock();
return;
}
const KritaUtils::ExportFileJob job = d->backgroundSaveJob;
d->backgroundSaveJob = KritaUtils::ExportFileJob();
// unlock at the very end
d->savingMutex.unlock();
KisUsageLogger::log(QString("Completed saving %1 (mime: %2). Result: %3")
.arg(job.filePath)
.arg(QString::fromLatin1(job.mimeType))
......
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