ScriptForge (SF_Base) tdf#156599 Error message when loading a form
Error occurs in SF_Base.IsLoaded(...)
"Object variable not set"
When user scripts run the method repeatedly from
nearly simultaneous events, it might happen
that the _FormDocuments private variable is
not initialized.
Simultaneous calls may be interpreted as internal
calls. Internal calls do not execute the "Check"
part of the published API.
Hence the failing initialization.
Solution: force the initialization of that specific
variable at each run.
Change-Id: I489cbaed7b8e57d6876b7af4b26f5be0beb3db69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157374
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
(cherry picked from commit 3ce1237c0149d05e993eaac41634ce5dfe2ccca6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157319
diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba
index 5c8c909..b7662b7 100644
--- a/wizards/source/sfdocuments/SF_Base.xba
+++ b/wizards/source/sfdocuments/SF_Base.xba
@@ -415,10 +415,10 @@ Const cstSubArgs = "FormDocument"
bLoaded = False
Check:
If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments()
If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
If Not _IsStillAlive() Then GoTo Finally
' Build list of available FormDocuments recursively with _CollectFormDocuments
If IsNull(_FormDocuments) Then Set _FormDocuments = _Component.getFormDocuments()
vFormNames = Split(_CollectFormDocuments(_FormDocuments), cstToken)
If Not ScriptForge.SF_Utils._Validate(FormDocument, "FormDocument", V_STRING, vFormNames) Then GoTo Finally
End If