🚨 Free the light config document and tolerate a missing file
LoadConfig leaked the parsed XML document on every call and aborted startup when the color config file was absent.
This commit is contained in:
@@ -385,7 +385,10 @@ begin
|
|||||||
|
|
||||||
//frmInitialize.SetStatusLabel(Format(frmInitialize.SplashLoading, ['ColorLight.xml']));
|
//frmInitialize.SetStatusLabel(Format(frmInitialize.SplashLoading, ['ColorLight.xml']));
|
||||||
// Read xml file from your hard drive
|
// Read xml file from your hard drive
|
||||||
|
if not FileExists(AFileName) then
|
||||||
|
Exit;
|
||||||
ReadXMLFile(XMLDoc, AFileName);
|
ReadXMLFile(XMLDoc, AFileName);
|
||||||
|
try
|
||||||
if LowerCase(XMLDoc.DocumentElement.NodeName) = 'colorlight' then
|
if LowerCase(XMLDoc.DocumentElement.NodeName) = 'colorlight' then
|
||||||
begin
|
begin
|
||||||
iNode := XMLDoc.DocumentElement.FirstChild;
|
iNode := XMLDoc.DocumentElement.FirstChild;
|
||||||
@@ -462,6 +465,9 @@ begin
|
|||||||
iNode := iNode.NextSibling;
|
iNode := iNode.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
finally
|
||||||
|
XMLDoc.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TLightSource }
|
{ TLightSource }
|
||||||
|
|||||||
Reference in New Issue
Block a user