View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004285 | JEDI VCL | 00 JVCL Components | public | 2007-10-31 12:54 | 2007-12-16 12:58 |
Reporter | locopablo | Assigned To | AHUser | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.32 | ||||
Target Version | Fixed in Version | 3.34 | |||
Summary | 0004285: TJvMemoryData causes access violation when assigning a WideString value to a TWideStringField | ||||
Description | Assigning a value to a WideString field causes an access violation. Sample code: memds := TJvMemoryData.Create(nil); try memds.FieldDefs.Add('ss', ftString, 20, False); memds.FieldDefs.Add('ws', ftWideString, 20, False); memds.Active := True; memds.Append; memds.Fields[0].Value := 'abc123'; // next line causes A/V memds.Fields[1].Value := 'abc123'; memds.Post; finally FreeAndNil(memds); end; | ||||
Additional Information | Failure seems to be caused by this function: procedure TJvMemoryData.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean); begin if Field.DataType = ftWideString then begin // copied from DB.PAS - this works OK WStrCopy(PWideChar(Dest), PWideChar(Source)); { // Original code - crashes with A/V if ToNative then begin Word(Dest^) := Length(PWideString(Source)^) * 2; Move(PWideChar(Source^)^, (PWideChar(Dest) + 1)^, Word(Dest^)); end else SetString(WideString(Dest^), PWideChar(PChar(Source) + 2), Word(Source^) div 2); } end else inherited DataConvert(Field, Source, Dest, ToNative); end; | ||||
Tags | No tags attached. | ||||
|
It seems the internal data handling has changed quite a bit between versions and the code above does not make BDS2006 very happy... BDS 2006 includes its own internal storage of WideString data, which uses the WStrCopy() function. Adding an ifdef to the DataConvert function makes WideString value assignemt work for both BDS2006 and Delphi 5. interface ...TJvMemoryData... {$IFNDEF DELPHI10_UP} procedure DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean); end; {$ENDIF} implementation {$IFNDEF DELPHI10_UP} procedure TJvMemoryData.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean); begin ... end; {$ENDIF} |
|
Fixed in SVN. |
Date Modified | Username | Field | Change |
---|---|---|---|
2007-10-31 12:54 | locopablo | New Issue | |
2007-11-07 08:27 | locopablo | Note Added: 0014024 | |
2007-12-16 12:58 | AHUser | Status | new => resolved |
2007-12-16 12:58 | AHUser | Fixed in Version | => Daily / SVN |
2007-12-16 12:58 | AHUser | Resolution | open => fixed |
2007-12-16 12:58 | AHUser | Assigned To | => AHUser |
2007-12-16 12:58 | AHUser | Note Added: 0014067 | |
2008-11-02 12:34 | AHUser | Relationship added | has duplicate 0004412 |