I have defined an interface for a set of bytes and a class implementing interface. In the interface TTestSetofByte + the recipient and setter type property is absolutely nothing.
Type TTestSetOfByte = set of bytes; ITestInterface = Interface ['{BCF0CEC2-F999-4E8A-A732-416F343C1629}'] GetPropSetOfByte function: TTestSetOfByte; Process SetPropSetOfByte (const value: TTestSetOfByte); Property PropSetOfByte: ReadTTestSetOfByte Read GetPropSetOfByte SetPropSetOfByte; End; TTestClass3 = Class (TInterfacedObject, ITestInterface) Private FSetOfByte: TTestSetOfByte; GetPropSetOfByte function: TTestSetOfByte; Process SetPropSetOfByte (const value: TTestSetOfByte); Make Public Builders; Property PropSetOfByte: ReadTTestSetOfByte Read GetPropSetOfByte SetPropSetOfByte; End; The problem is that when I try to read the value of property PropSetOfByte , DEF throws a EAccessViolation and I understand That's not coming in. Other types of properties (int, string) work fine.
Here is the test code:
Process TTestUtlRttiComparer.DeleteMe; Var i: integer; Example 1: iTest Interface; Object 1: Tuboject; Reticontex: Treticontex; Retippress: TrettiProperty; RttiValue1: TLL; Type 1: Trettype; Start Instant 1: = TTestClass3.Create; Check (Instance1.PropSetOfByte = [1,4], 'Make sure that the working person works!'); Instance 1.propsetoffbyte: = [3,4]; Check (Instance1.PropSetOfByte = [3,4], 'make sure the setter works!'); Object 1: = (in the form of Instance 1 tubage); Czech (Assigned (Object1)); RttiContext: = TRttiContext.Create; Try 1: = RttiContext.GetType (Object1.ClassInfo); // Properties for Prefen: = 0 to higher (type 1.GetProperties), RttiProp: = Type1. Gate Properties [i]; If RttiProp.Name = 'PropSetOfByte' then start RttiValue1: = RttiProp.GetValue (Object1); // Check this with ECSViolation failed! End; End; Finally Routiccontex free; End; End; I am using XE-2.
Thank you!
it crashes when TRttiType.GetValue () (more specific) By format, the invoke () function tries to call System.Rtti unit) TTestClass3.GetPropSetOfByte () . The correct self is being passed in the pointer, but the results parameter is zero, so when there is an accident, GetPropSetOfByte () to FSetOfByte to results .
In short, the call stack is not being setup correctly by the RTTI system for set . I have republished the accident in XE2, XE6, and XE7, and filed a bug report with the mbarcadoro:
TRttiProperty.GetValue () crash on set-based property
No comments:
Post a Comment