True. I just thought I'd add that for clarification on what setting it to nil 
does, for anyone who didn't already know that. 

Dave

Doug Hale <[EMAIL PROTECTED]> wrote:                             If I am doing 
the create and free, then I should know when and when not 
 to nil.
 
 If some other code is doing create or free, then I should know something 
 about the other code before I create, free, or nil.
 
 Doug
 
 David Smith wrote:
 > With secondary forms, you want to nil it because otherwise your app will 
 > think the form is still in memory. Not good if you plan on instantiating 
 > multiple copies of it during the lifetime
 >   of the app.
 >   Dave
 >
 > Doug Hale <[EMAIL PROTECTED]> wrote:
 >           
 > This is what I do also - I only nil the pointer if I am going to test 
 > it, otherwise I don't bother.
 > Doug
 >
 > David Smith wrote:
 >   
 >> I usually follow what every example in Delphi manual does. There are 
 >> certain cases where freeAndNil can cause an access violation:
 >>
 >> Object.Free;
 >> Object := nil;
 >>
 >> Dave
 >>
 >> Doug Hale <[EMAIL PROTECTED]> wrote: 
 >>     
 >>> And as a hint, try not to use the destructor Destroy
 >>> directly.
 >>> The documentation suggests using Free because it
 >>> checks whether the object for which you are calling
 >>> Free is Nil or not. If it is Nil, it will not call
 >>> Destroy.
 >>>
 >>>       
 >> someobject.free still requires a valid someobject pointer with which to 
 >> call free.
 >>
 >> If you want the above behavior, you must call FreeAndNil(someobject).
 >>
 >> Doug
 >>
 >>
 >>
 >>
 >>
 >>
 >> ---------------------------------
 >> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it 
 >> now.
 >>
 >> [Non-text portions of this message have been removed]
 >>
 >>
 >> ------------------------------------
 >>
 >> -----------------------------------------------------
 >> Home page: http://groups.yahoo.com/group/delphi-en/
 >> To unsubscribe: [EMAIL PROTECTED] Groups Links
 >>
 >>
 >>
 >>
 >>
 >>
 >>     
 >
 >
 >
 >                            
 >
 >        
 > ---------------------------------
 > Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it 
 > now.
 >
 > [Non-text portions of this message have been removed]
 >
 >
 > ------------------------------------
 >
 > -----------------------------------------------------
 > Home page: http://groups.yahoo.com/group/delphi-en/
 > To unsubscribe: [EMAIL PROTECTED] Groups Links
 >
 >
 >
 >
 >
 >   
 
 
     
                                       

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[Non-text portions of this message have been removed]

Reply via email to