CloseAll
Posted: Wed Apr 22, 2020 6:25 am
There is a problem in CloseAll implementation in Runtime/XSharp.Core/RDD/Workareas.prg
If an exception is raised while closing a particular work area the further work areas would omit getting closed due to Result turns into False and that's ok, but after the cycle Aliases and Cargo arrays would get cleaned regardless of whether all the areas were closed.
If an exception is raised while closing a particular work area the further work areas would omit getting closed due to Result turns into False and that's ok, but after the cycle Aliases and Cargo arrays would get cleaned regardless of whether all the areas were closed.
Code: Select all
PUBLIC METHOD CloseAll() AS LOGIC
LOCAL lResult := TRUE AS LOGIC
BEGIN LOCK RDDs
RuntimeState.LastRddError := NULL
FOREACH VAR element IN Aliases
VAR nArea := element:Value -1
IF RDDs[nArea] != NULL
VAR oRdd := RDDs[nArea]
TRY
lResult := lResult .AND. oRdd:Close()
CATCH e AS Exception
lResult := FALSE
RuntimeState.LastRddError := e
END TRY
RDDs[nArea] := NULL
ENDIF
NEXT
Aliases:Clear()
cargo:Clear()
iCurrentWorkarea := 1
END LOCK
RETURN lResult