View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003570 | JEDI VCL | 00 JVCL Components | public | 2006-03-09 15:05 | 2006-03-10 02:48 |
Reporter | Kiriakos | Assigned To | AHUser | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | 3.30 | |||
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. | ||||