You are not logged in.
Hi, Delphi20009ent
We have TInterfacedCollection class with internal TPersistent objects.
If we leave plain syntax without getScale and setScale it's ok. Is this intended?
TCustomScale=Class(TPersistent);
myObject(TInterfacedCollection)
published
....
property Scaling : TCustomScale read FScale Write FScale; // this is OK
...
but if I use
....
property Scaling : TCustomScale read getScale Write setScale; // access violation
...
Eureka Log:
2.1 Date : Wed, 31 Oct 2012 17:59:17 +0100
2.2 Address : 004D7617
2.3 Module Name : EMRASvr.exe
2.4 Module Version:
2.5 Type : EAccessViolation
2.6 Message : Access violation at address 004D7617 in module 'EMRASvr.exe'. Read of address 00000000.
2.7 ID : 3917
2.8 Count : 1
2.9 Status : New
2.10 Note :
Address Module Unit Class Procedure/Method Line Rel. line
004CEB52 EMRASvr.exe SQLite3Commons.pas JSONToObject 21634 3
004CEB18 EMRASvr.exe SQLite3Commons.pas JSONToObject 21631 0
004CF34D EMRASvr.exe SQLite3Commons.pas JSONToObject 21884 253
004CEB18 EMRASvr.exe SQLite3Commons.pas JSONToObject 21631 0
004CEE0C EMRASvr.exe SQLite3Commons.pas JSONToObject 21718 87
004CEB18 EMRASvr.exe SQLite3Commons.pas JSONToObject 21631 0
if (Value=nil) or (PPointer(Value)^=nil) then
exit;
..
// will handle '[TCollection...' '[TStrings...' '{TObject...'
From := JSONToObject(PObject(P^.GetFieldAddr(Value))^,From,NestedValid);
CollItem := Coll.Add;
From := JSONToObject(CollItem,From,NestedValid); <=== access violation (wants to update Scaling object property)
Thank you,
Vojko
Last edited by VojkoCendak (2012-10-31 17:10:29)
Offline
Yes, this is not implemented.
Objects properties are expected to be stored by value, not using getters/setters.
Custom serialization is to be used if you want more complex streaming.
Offline
It works with normal properties like integer, string, but not (yet ) with classes.
Delphi has GetObjectProp() if TTypeKind = tkClass and get set procedure is <> nil.
thank you,
Vojko
Offline
A ticket has been created for this issue.
Offline