Subject | Re: [IBO] Problem with IB_Session |
---|---|
Author | Helen Borrie |
Post date | 2006-08-30T02:48:25Z |
At 11:22 AM 30/08/2006, you wrote:
should only do if you can't get away with not doing it or as
something you oblige yourself to do to comply with the object model
because it's proven best practice.
The rule I've always followed is to use a nil owner only in the
(hopefully rare) situation where the object is likely to be shared by
multiple objects. In those cases, one must be careful protect the
fate of the object in finalization code, either in a try...finally
block or in the program's finalization code, according to
scope. Otherwise, making Self the owner will ensure that the object
that created it knows it has to call its destructor.
Helen
>The IB components need to be created and freed within the .ExecuteDepends I guess whether you define a "requirement" as something you
>method. Changing the code to work this way fixes the problem.
>
>Re your comments about the session having no owner, I have never used an
>owner for the session. Is it a requirement and what should I use there
>if I am using it within a thread that will free itself and is created by
>an object that will have been freed well before the thread completes?
should only do if you can't get away with not doing it or as
something you oblige yourself to do to comply with the object model
because it's proven best practice.
The rule I've always followed is to use a nil owner only in the
(hopefully rare) situation where the object is likely to be shared by
multiple objects. In those cases, one must be careful protect the
fate of the object in finalization code, either in a try...finally
block or in the program's finalization code, according to
scope. Otherwise, making Self the owner will ensure that the object
that created it knows it has to call its destructor.
>Re 2 Believe it or not but was really all the non-commented code ! I doI'm still trying to figure that one out...
>create the session before all other components and free it after they
>are freed, just all that was commented out in my example.
Helen