View Issue Details

IDProjectCategoryView StatusLast Update
0002620JEDI VCL00 JVCL Componentspublic2005-02-13 05:52
ReporterremkobonteAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 BETA 2 
Target VersionFixed in Version3.00 
Summary0002620: Run-time constructed AppStorage empties the storage.
DescriptionIf you create an appstorage at run-time, don't reload it, then on destruction it will empty the storage.

Code:

with TJvAppXmlFileStorage.Create(nil) do
try
  FileName := 'temp.xml';
finally
  Free;
end;

temp.xml will be filled with:

<?xml version="1.0" encoding="iso-8859-1"?>
<Configuration/>
Additional Information* TJvCustomAppStorage.Loaded solves this for components dropped on a form by calling Reload (Loaded is offcourse not called for components created at run-time). I think when AutoReload is False, the component should NOT automatically load the storage in memory.

procedure TJvCustomAppStorage.Loaded;
begin
  inherited Loaded;
  if not IsUpdating then
    Reload;
end;

* TJvCustomAppMemoryFileStorage.SetFileName calls Reload when FLoadedFinished is set to true. I suspect the creator of that code wanted it to work the same as the csLoading flag, but for run-time created storages FLoadedFinished will always be false (because Loaded is never called).
TagsNo tags attached.

Activities

obones

2005-02-12 09:31

administrator   ~0006472

What if you replace this:

    if FLoadedFinished and not IsUpdating then

by this:

    if not (csLoading in ComponentState) and not IsUpdating then

In both SetFileName and SetLocation.
I tried this here, it seems to work with both methods: Design time and Run time.

remkobonte

2005-02-13 05:18

developer   ~0006477

Yeah, that probably works, although you have to set Location before FileName now at run-time.

Any reason why these components do not have an Active property?

obones

2005-02-13 05:52

administrator   ~0006478

This is now in CVS.
Note that you don't have to set the properties in any particular order, as it will load the file in both cases, and do it silently if the file does not exist.
As to getting an Active property, I don't see the point as it is all in memory after all.

Issue History

Date Modified Username Field Change
2005-02-10 13:57 remkobonte New Issue
2005-02-11 03:31 obones Status new => assigned
2005-02-11 03:31 obones Assigned To => obones
2005-02-12 09:31 obones Note Added: 0006472
2005-02-12 09:31 obones Status assigned => feedback
2005-02-13 05:18 remkobonte Note Added: 0006477
2005-02-13 05:52 obones Status feedback => resolved
2005-02-13 05:52 obones Fixed in Version => 3.00
2005-02-13 05:52 obones Resolution open => fixed
2005-02-13 05:52 obones Note Added: 0006478