mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 20:23:06 +02:00
fix upload leak, return error for failed load
This commit is contained in:
parent
46990184d6
commit
549c514400
3 changed files with 13 additions and 1 deletions
|
@ -131,6 +131,9 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
|
||||||
case AssetUpload::TooLarge:
|
case AssetUpload::TooLarge:
|
||||||
additionalError = "The uploaded content was too large and could not be stored in the asset-server.";
|
additionalError = "The uploaded content was too large and could not be stored in the asset-server.";
|
||||||
break;
|
break;
|
||||||
|
case AssetUpload::ErrorLoadingFile:
|
||||||
|
additionalError = "The file could not be opened. Please check your permissions and try again.";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// not handled, do not show a message box
|
// not handled, do not show a message box
|
||||||
return;
|
return;
|
||||||
|
@ -139,6 +142,8 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
|
||||||
// display a message box with the error
|
// display a message box with the error
|
||||||
showErrorDialog(QFileInfo(upload->getFilename()).fileName(), additionalError);
|
showErrorDialog(QFileInfo(upload->getFilename()).fileName(), additionalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upload->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetUploadDialogFactory::showErrorDialog(const QString& filename, const QString& additionalError) {
|
void AssetUploadDialogFactory::showErrorDialog(const QString& filename, const QString& additionalError) {
|
||||||
|
|
|
@ -57,5 +57,11 @@ void AssetUpload::start() {
|
||||||
emit finished(this, hash);
|
emit finished(this, hash);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// we couldn't open the file - set the error result
|
||||||
|
_result = ErrorLoadingFile;
|
||||||
|
|
||||||
|
// emit that we are done
|
||||||
|
emit finished(this, QString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ public:
|
||||||
Success = 0,
|
Success = 0,
|
||||||
Timeout,
|
Timeout,
|
||||||
TooLarge,
|
TooLarge,
|
||||||
PermissionDenied
|
PermissionDenied,
|
||||||
|
ErrorLoadingFile
|
||||||
};
|
};
|
||||||
|
|
||||||
AssetUpload(QObject* parent, const QString& filename);
|
AssetUpload(QObject* parent, const QString& filename);
|
||||||
|
|
Loading…
Reference in a new issue