Skip to content

Commit 77ea525

Browse files
committed
Fix windows errors removing temporary files when downloading a cloud project
1 parent da29c2d commit 77ea525

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/qfieldcloudprojectsmodel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,6 @@ void QFieldCloudProjectsModel::projectDownloadFiles( const QString &projectId )
12051205

12061206
NetworkReply *reply = downloadFile( projectId, fileName );
12071207
QTemporaryFile *file = new QTemporaryFile( reply );
1208-
12091208
file->setAutoRemove( false );
12101209

12111210
if ( !file->open() )
@@ -1267,7 +1266,9 @@ bool QFieldCloudProjectsModel::projectMoveDownloadedFilesToPermanentStorage( con
12671266
}
12681267

12691268
if ( !file.remove() )
1269+
{
12701270
QgsMessageLog::logMessage( QStringLiteral( "Failed to remove temporary file `%1`" ).arg( fileName ) );
1271+
}
12711272
}
12721273

12731274
return !hasError;
@@ -1832,6 +1833,8 @@ void QFieldCloudProjectsModel::downloadFileConnections( const QString &projectId
18321833
errorMessageDetail = file.errorString();
18331834
errorMessage = tr( "File system error. Failed to write file to temporary location `%1`." ).arg( temporaryFileName );
18341835
}
1836+
1837+
file.close();
18351838
}
18361839
else
18371840
{

0 commit comments

Comments
 (0)