You are not logged in.
Hi, Delphi2009ent
We have a working TCollection item from TInterfacedCollection. (it worked with previous version of mOrmot).
  TremotePLC = class(TCollectionItem)
  published
    // server itemhandle
    property lokacija:string read flokacija write flokacija;
    property IP:string read fIP write fIP;
    property Connected:Boolean read fConnected write fConnected;
    property ErrStr:string read fErrStr write fErrStr;
    property numPersecs:Integer read fnumPersecs write fnumPersecs;
    property dbblokov:Integer read fdbblokov write fdbblokov;
    property dbblocksstrs:string read fdbblocksstrs write fdbblocksstrs;
  { Description:
      db;tagname;connectionstr;value;quality;active;sessiontime }
    property tagsstr:string read ftagsstr write ftagsstr;  // if this is longer than 257 -> access violation
  end;to reproduce:
var
  I: Integer;
  ljsonstr: RawUTF8;
begin
  aPLCStatuess:= TremotePLCs.Create;
  plc := aPLCStatuess.Add;
  plc.tagsstr := '';
  for J := 0 to 257 do plc.tagsstr := plc.tagsstr +'_';
  ljsonstr := ObjectToJSON(aPLCStatuess);
  JSONToObject(aPLCStatuess,PUTF8Char(ljsonstr),lvalid); ==> access violationif we use widestring it's ok.
thank you, vojko
Last edited by VojkoCendak (2013-04-24 10:38:04)
Offline
I was able to reproduce the issue with Delphi XE3 (no problem with non Unicode version of Delphi).
We have replaced unexpected use of Utf8ToUnicodeString() into correct SynCommons value.
See http://synopse.info/fossil/info/f67ad3556e
It will fix such potential GPF in JSONToObject() when unserializing UnicodeString properties.
Thanks a lot for the report, even if the code to reproduce the problem was truncated.![]()
Offline
It's working now. Thank you.
Offline