[fpc-devel] LocalReferenceFixup

Michael Van Canneyt michael at freepascal.org
Tue Oct 5 13:10:43 CEST 2010



On Tue, 5 Oct 2010, José Mejuto wrote:

> Hello Martin,
>
> Tuesday, October 5, 2010, 9:56:41 AM, you wrote:
>
>>> I find a problem that I'm unable to resolve, with my limited skills.
>>> In TReader when a property is a TClass it is being added to be
>>> resolved after all components are loaded, but the "Loaded" call is
>>> performed before this fixup, so when a component receive the "Loaded"
>>> signal some fields are still not completly filled in.
> MS> Use
> MS> "
> MS> procedure BeginGlobalLoading;
> MS> procedure NotifyGlobalLoading;
> MS> procedure EndGlobalLoading;
> MS> "
>
> I see, but there is still a problem, I think. Let me explain:
>
> 1) Component is being read, it reads Active property, if set and
> csLoading then the "active" is postponed to "afterload".
> 2) The "Database" property is being read, but as it is a TClass it is
> added to LocalFixups.
> 3) The remaining properties are beign read.
> 4) Component is notified with "Loaded" signal, so it tries to active
> itself, but database is not set.
> 5) Fixups are performed.
> 6) Component is notified again with "Loaded" signal.
>
> I do not know how to instruct the component to skip the first "Loaded"
> signal and wait for the next one, specially because if "Database" is
> not set (trully error) the second "Loaded" signal will not be fired.
> Maybe a component state like "csFixupsPending" ?
>
> I do not have too much experience with components, but calling
> "Loaded" several times does not look very fine.

To the best of my knowledge: it should be called once only, after the fixups. 
If it isn't so, this is a bug.

Michael.


More information about the fpc-devel mailing list