[fpc-pascal] urgent: change in TObject.free() ?

Marc Santhoff M.Santhoff at t-online.de
Mon Dec 18 22:40:20 CET 2006


Hi,

I'm hunting a bug atm and do think I have found something (in my own
program). There is a call to TObject.free in an derived class that seems
to throw an exception. So far so clear, but I'm getting nervous on the
part that anything worked flawlessly until today.

May this be a change in checking object references or pointer checking
in the compiler between fpc 1.9.4 and 2.0.2?

An unhandled exception occurred at $282E7620 :
EAccessViolation : Access violation
  $282E7620  COMMENTDIALOG_finalize_implicit,  line 74 of Controller.pp
  $080B1970  TCUSTOMERBROWSER__DESTROY,  line 434 of CustomerBrowser.pp
  $08057655
  $080AA1D2  ONBTNOKAYCLICK,  line 576 of StateInput.pp
  $28285255  COMMENTDIALOG_finalize_implicit,  line 74 of Controller.pp
...

The line under suspicion is:

576:		br.free;
577:		br := NIL;

where "br" is declared:

TCustomerBrowser = class
...

so it is a direct descendant of TObject.

I will try to use

		if Assigned(br) then br.free;

but to be sure I need to know if this new behaviour can be triggered by
using the newer compiler and its libraries.

TIA,
Marc





More information about the fpc-pascal mailing list