Sign in Join

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

Mailing lists / fpc-pascal / 2006-12

urgent: change in TObject.free() ?

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Marc Santhoff

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