Incomplete image file download automatic deletion

Little update to delete incomplete (eventually malformed) image file
This commit is contained in:
djes
2019-07-18 20:56:33 +02:00
parent 741aa2afb1
commit 705be8f877

View File

@@ -1273,7 +1273,7 @@ Module PBMap
EndIf
; End of the memory cache access
;LockMutex(*PBMap\MemoryCacheAccessMutex)
PostEvent(#PB_Event_Gadget, *Tile\Window, *Tile\Gadget, #PB_MAP_TILE_CLEANUP, *Tile) ; To free memory outside the thread
PostEvent(#PB_Event_Gadget, *Tile\Window, *Tile\Gadget, #PB_MAP_TILE_CLEANUP, *Tile) ; To free memory and eventually delete aborted image file outside the thread
;UnlockMutex(*PBMap\MemoryCacheAccessMutex)
EndProcedure
@@ -2720,6 +2720,11 @@ Module PBMap
EndIf
Else
*PBMap\MemCache\Images(key)\Tile = 0
If DeleteFile(*Tile\CacheFile)
MyDebug(*PBMap, " Deleting not fully loaded image file " + *Tile\CacheFile, 3)
Else
MyDebug(*PBMap, " Can't delete not fully loaded image file " + *Tile\CacheFile, 3)
EndIf
EndIf
EndIf
FreeMemory(*Tile) ; Frees the data needed for the thread (*tile=*PBMap\MemCache\Images(key)\Tile)
@@ -3183,8 +3188,8 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf
; IDE Options = PureBasic 5.70 LTS (Windows - x64)
; CursorPosition = 1369
; FirstLine = 1354
; CursorPosition = 1261
; FirstLine = 1242
; Folding = ---------------------
; EnableThread
; EnableXP