[fpc-devel] LocalReferenceFixup

José Mejuto joshyfun at gmail.com
Thu Oct 7 17:25:28 CEST 2010


Hello FPC,

Thursday, October 7, 2010, 8:27:23 AM, you wrote:

MS> Maybe you mix up component creation order and form/datamodule creation order?
MS> I wrote about form/datamodule creation order.

The datamodule is created just in program load, before any dependent
component is created, so my execution layout is:

1) Main form create (only a bunch of visual options).
2) Datamodules are being created and will keep loaded up to main form
destroy.
3) When user selects an option in main form, the new form, with some
SQLQuery components inside linked with the already loaded
datamodule(s), is being created and the problem happends.

MS> MSEide does not create the code for loading additional forms and datamodules
MS> exactly because it is necessary that the user knows what is going on there.
MS> Please have a look into the program file of your application. I repeat:
MS> If there are interlinked forms/datamodules either:
MS> - Avoid circular component references.
MS> - Create the referencing forms/datamodules after the referenced 
MS> forms/datamodules.

I'm not using MSEide, but of course all referenced objects (databases
in this case) are being created before the conflictive
forms/components.

MS> Or:
MS> - Call msebegingloballoading.
MS> - Create the forms/datamodules.
MS> - Create mseendgloballoading.

I'll check this approach, but just to circunvent the problem. A
different thing is that maybe the bug/problem is in SQLQuery, in
TReader, in Lazarus logic or in any other piece of code.

MS> A Lazarus adept may write the necessary steps for Lazarus.
MS> If you get the exception in a single form without external component
MS> references, that would be another story...

I'm not sure 100%, changed the database connections to datamodules to
keep forms a bit cleaner, but I'm quite sure that the same problem
happends using a single form with all needed components in the form
(as in the past).

As you are the only one replaying (a lot of thanks) this makes me
think that other developers think that this behavior is OK in TReader,
so I'll try to post a simple form code in the Lazarus list and ask for
feedback about how it should work.

Thank you again for your support.

-- 
Best regards,
 José




More information about the fpc-devel mailing list