[fpc-pascal] crash in tobject.free

David Emerson dle3ab at angelbase.com
Thu Dec 9 23:48:23 CET 2010


Thanks Matthias, FreeAndNil solved my problem! I was assuming that calling Free 
would also nil out the variable holding the reference to the object, but 
obviously it does not.

Cheers,
David


On Thu 9 Dec 2010, Matthias Klumpp wrote:
> Hi!
> On Thu, 9 Dec 2010 11:42:20 -0800, David Emerson <dle3ab at angelbase.com>
> wrote:
> > I'm encountering a consistent crash, and I'm not sure how to address the
> 
> > problem.
> > 
> > using:
> > - laz 0.9.28.2-8 beta, svn 22277, from debian testing -- a rather
> outdated
> > one, 
> > because at this point upgrading lazarus requires updating debian
> > - fpc 2.4.0-2 [2010/02/20] for i386
> > - fpgui commit e01c52a650bfdcce0bb1c8bbceefeb4e8dd46764
> > 
> > The lazarus popup error message says:
> > 
> > Project Swindow raised exception class 'External: SIGSEGV'.
> > 
> > The top of the lazarus call stack shows:
> > 
> > #0 :00000000 ?? at :0
> > #1 :08058BC2 SYSTEM_TOBJECT_$__FREE at :0
> > 
> > #2 is my own call: if assigned (f_image) then f_image.free;
> > 
> > I broke up the line, and it's crashing on the "then f_image.free" part,
> > rather 
> > than on the "if assigned(f_image)" part.
> > 
> > Any ideas?
> Have you initialized f_image? If not, do f_image := nil; and the error
> will be gone. (Assigned need this to check if the object exists)
> You could also use if assigned (f_image) then FreeAndNil(f_image);
> Hope this works!
>   Matthias Klumpp
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 






More information about the fpc-pascal mailing list