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.
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
All workareas will be closed and removed from the RDDs, Aliases and cargo array as far as I can see in that code.
Maybe the workarea object that fails to close is not completely closed, but it is no longer linked to a workarea number or alias.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
I think Serggio is right, after lResult becomes FALSE, then in this code:
lResult := lResult .AND. oRdd:Close()
the next time oRdd:Close() will never be executed, because the expression is already evaluated to false by checking lResutl (FALSE) and the CLR does not evaluate the 2nd expression.