View Issue Details

IDProjectCategoryView StatusLast Update
0003273JEDI VCL00 JVCL Componentspublic2006-04-05 06:34
ReporterKrzysztof RaczkowskiAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version3.00 
Target VersionFixed in Version 
Summary0003273: JvMemoryData, problem with CopyStructure
Descriptionprocedure TJvMemoryData.CopyStructure(Source: TDataSet; UseAutoIncAsInteger: Boolean);
var
  I: Integer;
begin
  if Source = nil then
    Exit;
  CheckInactive;
  for I := FieldCount - 1 downto 0 do
    Fields[I].Free;

  Source.FieldDefs.Update;

/// !!!!!!!! This is v. dangerous ... if you do this ... Source.Free :) after /// CopyStructure
/// FieldDefs := Source.FieldDefs;

   FieldDefs.Assign(Source); //it's better :)

  if FApplyMode <> amNone then
    AddStatusField;
  CheckStructure(UseAutoIncAsInteger);
  if FApplyMode <> amNone then
    HideStatusField;
end;
TagsNo tags attached.

Activities

Arioch

2006-02-14 13:07

developer   ~0008556

Ohh, this seems to be a thing that amased me with *.Font and all other properties in VCL ;-)

Last version of RxMemoryData does not provide anything new FieldDefs-specific.
So i'd just quote VCL 5 to argue that this assignment is absolutely safe:

TDataSet
...
property FieldDefs: TFieldDefs read FFieldDefs write SetFieldDefs;
...
procedure TDataSet.SetFieldDefs(Value: TFieldDefs);
begin
  FieldDefs.Assign(Value);
end;

obones

2006-04-05 06:34

administrator   ~0008974

Yes, FieldDefs is a property and the assign is done for us. So this is not a bug.

Issue History

Date Modified Username Field Change
2005-10-18 05:42 Krzysztof Raczkowski New Issue
2006-02-14 13:07 Arioch Note Added: 0008556
2006-04-05 06:34 obones Status new => resolved
2006-04-05 06:34 obones Resolution open => no change required
2006-04-05 06:34 obones Assigned To => obones
2006-04-05 06:34 obones Note Added: 0008974