Better quit handling

This commit is contained in:
djes
2016-08-25 13:51:34 +02:00
parent a4f2ea5bb7
commit 5fc43503e0

View File

@@ -25,7 +25,7 @@ UsePNGImageEncoder()
DeclareModule PBMap DeclareModule PBMap
;-Show debug infos ;-Show debug infos
Global Verbose = #True Global Verbose = #false
Global MyDebugLevel = 3 Global MyDebugLevel = 3
Global Proxy = #False Global Proxy = #False
Declare InitPBMap() Declare InitPBMap()
@@ -292,18 +292,19 @@ Module PBMap
;Ask main drawing thread to stop and wait for it (nicer than KillThread(PBMap\MainDrawingThread)) ;Ask main drawing thread to stop and wait for it (nicer than KillThread(PBMap\MainDrawingThread))
LockMutex(PBMap\Drawing\Mutex) LockMutex(PBMap\Drawing\Mutex)
PBMap\Drawing\End = #True PBMap\Drawing\End = #True
;KillThread(PBMap\MainDrawingThread)
UnlockMutex(PBMap\Drawing\Mutex) UnlockMutex(PBMap\Drawing\Mutex)
Repeat : Until Not IsThread(PBMap\MainDrawingThread) Repeat : Until Not IsThread(PBMap\MainDrawingThread)
;wait for loading threads to finish nicely ;Wait for loading threads to finish nicely
Repeat
ResetList(PBMap\TilesThreads()) ResetList(PBMap\TilesThreads())
While NextElement(PBMap\TilesThreads()) While NextElement(PBMap\TilesThreads())
If IsThread(PBMap\TilesThreads()\GetImageThread) = 0 If IsThread(PBMap\TilesThreads()\GetImageThread) = 0
FreeMemory(PBMap\TilesThreads()\Tile) FreeMemory(PBMap\TilesThreads()\Tile)
DeleteElement(PBMap\TilesThreads()) DeleteElement(PBMap\TilesThreads())
ResetList( PBMap\TilesThreads())
EndIf EndIf
Wend Wend
Delay(20)
Until ListSize(PBMap\TilesThreads()) = 0
curl_global_cleanup() curl_global_cleanup()
EndProcedure EndProcedure
@@ -1191,6 +1192,8 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf CompilerEndIf
; IDE Options = PureBasic 5.50 (Windows - x64) ; IDE Options = PureBasic 5.50 (Windows - x64)
; ExecutableFormat = Console ; ExecutableFormat = Console
; CursorPosition = 305
; FirstLine = 278
; Folding = --------- ; Folding = ---------
; EnableThread ; EnableThread
; EnableXP ; EnableXP