|
@@ -118,7 +118,7 @@ end;
|
|
|
|
|
|
procedure TXMLConfig.Flush;
|
|
|
begin
|
|
|
- if Modified then
|
|
|
+ if (Filename<>EmptyStr) and Modified then
|
|
|
begin
|
|
|
WriteXMLFile(Doc, Filename);
|
|
|
FModified := False;
|
|
@@ -375,14 +375,14 @@ begin
|
|
|
{$IFDEF MEM_CHECK}CheckHeapWrtMemCnt('TXMLConfig.SetFilename A '+AFilename);{$ENDIF}
|
|
|
if (not ForceReload) and (FFilename = AFilename) then
|
|
|
exit;
|
|
|
+ Flush;
|
|
|
+ FreeAndNil(Doc);
|
|
|
+
|
|
|
FFilename := AFilename;
|
|
|
|
|
|
if csLoading in ComponentState then
|
|
|
exit;
|
|
|
|
|
|
- Flush;
|
|
|
- FreeAndNil(Doc);
|
|
|
-
|
|
|
if FileExists(AFilename) and (not FStartEmpty) then
|
|
|
ReadXMLFile(Doc, AFilename);
|
|
|
|