I have a datasnap client / server in Delphi XE6
I am receiving an invalid pointer operation in the following server method call on the client side.
S := ClientModule1.ServerMethods1Client.getReport(RunReportObj,
ReturnFileSize);
when I debug (step into), it sees the error is within a nested object of the TRunReportObj I am passing to the server method
TRunReportObject
private
...
fCriteria: TCriteriaList;
...
public
function AddCrit(Const aField, aOperation: String; Const aValues: TStrings): TCriteriaObject;
property CritObjects[index: Integer]: TCriteriaObject read GetCritObject;
property Criteria: TCriteriaList read fCriteria write fCriteria;
...
end;
TCriteriaList is TObjectList
TCriteriaObject = class(TJSONParamObject)
private
fField: String;
fOperation: String;
fValues: TStringList;
function GetJSONObject: TJSONObject; override;
public
property Field: String read fField write fField;
property Operation: String read fOperation write fOperation;
property Values: TStringList read fValues write fValues;
constructor create;
destructor destroy;override;
end;
if I change fValues: TStringList to a string, it works fine
So, the issue is with the stringlist property "Values" which i have made sure it is created and destroyed
constructor TCriteriaObject.create;
begin
inherited Create;
fValues := TStringList.create;
end;
destructor TCriteriaObject.destroy;
begin
fValues.Free;
inherited destroy;
end;
I think there may be a marshalling issue??? Can anyone confirm this?
I have had similar problems in Delphi XE6. I had to convert any TStringList to String.
In your case :-
fValues : String;
Property Values : String read GetValues write SetValues;
In the routines GetValues and SetValues you need to convert to and from the string.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.