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
0003570 [JEDI VCL] 00 JVCL Components crash always 2006-03-09 15:05 2006-03-10 02:48
Reporter Kiriakos View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0003570: AppStorage bug when reading nested object lists in v3.2
Description The problem is in the following function. TargetStore.FCurrentInstanceCreateEvent is set to nil on exit which means that if this call made from an outer ReadObjectList call when the outer call will crash making a call to function which is set to nil.

function TJvCustomAppStorage.ReadObjectList(const Path: string; List: TList;
  ItemCreator: TJvAppStorageObjectListItemCreateEvent;
  const ClearFirst: Boolean = True; const ItemName: string = cItem): Integer;
var
  TargetStore: TJvCustomAppStorage;
  TargetPath: string;
begin
  if not ListStored(Path) and StorageOptions.DefaultIfValueNotExists then
    Result := List.Count
  else
  begin
    if ClearFirst then
      List.Clear;
    ResolvePath(Path + cSubStorePath, TargetStore, TargetPath); // Only needed for assigning the event
    TargetStore.FCurrentInstanceCreateEvent := ItemCreator;
    Result := ReadList(Path, List, ReadObjectListItem, ItemName);
    TargetStore.FCurrentInstanceCreateEvent := nil;
  end;
end;
Additional Information Solution.
Change the above method to:

function TJvCustomAppStorage.ReadObjectList(const Path: string; List: TList;
  ItemCreator: TJvAppStorageObjectListItemCreateEvent;
  const ClearFirst: Boolean = True; const ItemName: string = cItem): Integer;
var
  FOldInstanceCreateEvent: TJvAppStorageObjectListItemCreateEvent;
  TargetStore: TJvCustomAppStorage;
  TargetPath: string;
begin
  if not ListStored(Path) and StorageOptions.DefaultIfValueNotExists then
    Result := List.Count
  else
  begin
    if ClearFirst then
      List.Clear;
    ResolvePath(Path + cSubStorePath, TargetStore, TargetPath); // Only needed for assigning the event
    FOldInstanceCreateEvent := TargetStore.FCurrentInstanceCreateEvent;
    TargetStore.FCurrentInstanceCreateEvent := ItemCreator;
    Result := ReadList(Path, List, ReadObjectListItem, ItemName);
    TargetStore.FCurrentInstanceCreateEvent := FOldInstanceCreateEvent;
  end;
end;
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0008643)
AHUser (developer)
2006-03-10 02:48

Fixed in CVS.

- Issue History
Date Modified Username Field Change
2006-03-09 15:05 Kiriakos New Issue
2006-03-10 02:48 AHUser Status new => resolved
2006-03-10 02:48 AHUser Resolution open => fixed
2006-03-10 02:48 AHUser Assigned To => AHUser
2006-03-10 02:48 AHUser Note Added: 0008643


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