Always reset the maps render state if purging started

This commit is contained in:
Blue (Lukas Rieger) 2021-05-11 00:44:42 +02:00
parent 00d7d3e397
commit f4926fe72d
No known key found for this signature in database
GPG Key ID: 904C4995F9E1F800

View File

@ -68,20 +68,22 @@ public void doWork() throws Exception {
this.hasMoreWork = false;
}
// delete subFiles first to be able to track the progress and cancel
while (!subFiles.isEmpty()) {
Path subFile = subFiles.getLast();
FileUtils.delete(subFile.toFile());
subFiles.removeLast();
if (this.cancelled) return;
}
try {
// delete subFiles first to be able to track the progress and cancel
while (!subFiles.isEmpty()) {
Path subFile = subFiles.getLast();
FileUtils.delete(subFile.toFile());
subFiles.removeLast();
if (this.cancelled) return;
}
// make sure everything is deleted
FileUtils.delete(directory.toFile());
// reset map render state
if (this.map != null) {
this.map.getRenderState().reset();
// make sure everything is deleted
FileUtils.delete(directory.toFile());
} finally {
// reset map render state
if (this.map != null) {
this.map.getRenderState().reset();
}
}
}