Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004285 [JEDI VCL] 00 JVCL Components crash always 2007-10-31 12:54 2007-12-16 12:58
Reporter locopablo View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version 3.32
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);
  memds.FieldDefs.Add('ss', ftString, 20, False);
  memds.FieldDefs.Add('ws', ftWideString, 20, False);
  memds.Active := True;
  memds.Fields[0].Value := 'abc123';
// next line causes A/V
  memds.Fields[1].Value := 'abc123';

Additional Information Failure seems to be caused by this function:

procedure TJvMemoryData.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean);
  if Field.DataType = ftWideString then
    // copied from DB.PAS - this works OK
    WStrCopy(PWideChar(Dest), PWideChar(Source));
    { // Original code - crashes with A/V
    if ToNative then
      Word(Dest^) := Length(PWideString(Source)^) * 2;
      Move(PWideChar(Source^)^, (PWideChar(Dest) + 1)^, Word(Dest^));
      SetString(WideString(Dest^), PWideChar(PChar(Source) + 2), Word(Source^) div 2);
    inherited DataConvert(Field, Source, Dest, ToNative);

Tags No tags attached.
Attached Files

- Relationships
has duplicate 0004412resolvedAHUser unit jvMemoryDataset 

-  Notes
locopablo (reporter)
2007-11-07 08:27

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.


  procedure DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean);


procedure TJvMemoryData.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean);
AHUser (developer)
2007-12-16 12:58

Fixed in SVN.

- Issue History
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

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker