[fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

Michael Van Canneyt michael at freepascal.org
Sat Jan 14 08:48:09 CET 2023



On Fri, 13 Jan 2023, Wayne Sherman via fpc-devel wrote:

> Some related misunderstandings:
>
> 1) When StopRecordPropertyChanges is called it destroys all the
> change records (stored in TBits) in which case SaveToJSON saves ALL
> the properties even if they were not loaded or modified previously.

That is why StopRecordPropertyChanges is called before loading.


>
> 2) Nothing in restbase.pp or TBaseObject calls MarkPropertyChanged
> anyway, so no properties will get marked as modified during
> TGoogleRestDescription.LoadFromJSON.
>
> procedure TBaseObject.MarkPropertyChanged(AIndex: Integer);
> begin
>  If Assigned(FBits) then
>    FBits.SetOn(GetParentPropCount+(AIndex shr IndexShift));
> end;

Markpropertychanged is called in the setter of the properties generated by
the code generator: Check all generated units.

TGoogleRestDescription is readonly, it does not need that mechanism.

>
> 3) Both MarkPropertyChanged (above) and IsPropertyModified (below)
> require the properties declarations to have indexes and
> TGoogleRestDescription does not have indexes on any of its properties.

See above, point 2.

Michael.


More information about the fpc-devel mailing list