Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-12

crash in tobject.free

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Emerson

Hi all,

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?

Thanks,
David

Reply by email

Matthias Klumpp
to David Emerson

Hi!

David Emerson wrote 6 lines
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

Show quoted text 21 lines
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

Reply by email

David Emerson
to Matthias Klumpp

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

Matthias Klumpp wrote 42 lines
Hi! On Thu, 9 Dec 2010 11:42:20 -0800, David Emerson 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 - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email