LCL: property storage, initialize storage before reading and writing integers and booleans, like has been done for strings in r18793 and r19196 #e9adbdad62 (issue #14115)

git-svn-id: trunk@21127 -
This commit is contained in:
vincents 2009-08-07 08:32:45 +00:00
parent f075b648e1
commit 552c41ac04

View File

@ -700,12 +700,17 @@ end;
function TCustomPropertyStorage.ReadInteger(const Ident: string; DefaultValue: Longint): Longint; function TCustomPropertyStorage.ReadInteger(const Ident: string; DefaultValue: Longint): Longint;
begin begin
StorageNeeded(True);
try
Result := DoReadInteger(RootSection, Ident, DefaultValue); Result := DoReadInteger(RootSection, Ident, DefaultValue);
finally
FreeStorage;
end;
end; end;
function TCustomPropertyStorage.ReadBoolean(const Ident: string; DefaultValue: Boolean): Boolean; function TCustomPropertyStorage.ReadBoolean(const Ident: string; DefaultValue: Boolean): Boolean;
begin begin
Result := DoReadInteger(RootSection, Ident, Ord(DefaultValue)) <> Ord(False); Result := ReadInteger(Ident, Ord(DefaultValue)) <> Ord(False);
end; end;
procedure TCustomPropertyStorage.ReadRect(const Ident: string; procedure TCustomPropertyStorage.ReadRect(const Ident: string;
@ -746,12 +751,17 @@ end;
procedure TCustomPropertyStorage.WriteInteger(const Ident: string; Value: Longint); procedure TCustomPropertyStorage.WriteInteger(const Ident: string; Value: Longint);
begin begin
StorageNeeded(False);
try
DoWriteInteger(RootSection, Ident, Value); DoWriteInteger(RootSection, Ident, Value);
finally
FreeStorage;
end;
end; end;
procedure TCustomPropertyStorage.WriteBoolean(const Ident: string; Value: Boolean); procedure TCustomPropertyStorage.WriteBoolean(const Ident: string; Value: Boolean);
begin begin
DoWriteInteger(RootSection, Ident, Ord(Value)); WriteInteger(Ident, Ord(Value));
end; end;
procedure TCustomPropertyStorage.WriteRect(const Ident: string; procedure TCustomPropertyStorage.WriteRect(const Ident: string;
@ -775,7 +785,12 @@ end;
procedure TCustomPropertyStorage.EraseSections; procedure TCustomPropertyStorage.EraseSections;
begin begin
StorageNeeded(False);
try
DoEraseSections(RootSection); DoEraseSections(RootSection);
finally
FreeStorage;
end;
end; end;
procedure TCustomPropertyStorage.SetStoredValues(Value: TStoredValues); procedure TCustomPropertyStorage.SetStoredValues(Value: TStoredValues);