fix upload leak, return error for failed load

This commit is contained in:
Stephen Birarda 2015-08-27 15:12:08 -07:00
parent 46990184d6
commit 549c514400
3 changed files with 13 additions and 1 deletions

View file

@ -131,6 +131,9 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
case AssetUpload::TooLarge:
additionalError = "The uploaded content was too large and could not be stored in the asset-server.";
break;
case AssetUpload::ErrorLoadingFile:
additionalError = "The file could not be opened. Please check your permissions and try again.";
break;
default:
// not handled, do not show a message box
return;
@ -139,6 +142,8 @@ void AssetUploadDialogFactory::handleUploadFinished(AssetUpload* upload, const Q
// display a message box with the error
showErrorDialog(QFileInfo(upload->getFilename()).fileName(), additionalError);
}
upload->deleteLater();
}
void AssetUploadDialogFactory::showErrorDialog(const QString& filename, const QString& additionalError) {

View file

@ -57,5 +57,11 @@ void AssetUpload::start() {
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());
}
}

View file

@ -28,7 +28,8 @@ public:
Success = 0,
Timeout,
TooLarge,
PermissionDenied
PermissionDenied,
ErrorLoadingFile
};
AssetUpload(QObject* parent, const QString& filename);