On Mon, 26 Oct 2009, Alex Strickland wrote:

Hi

> Is it expected behavior that this program does not output "Destructor"?
> #include "hbclass.ch"
> static oMSCAL
[...]
> If I set oMSCAL to nil it does work of course.

Yes it's expected. Destructors are not executed for when static variables
are cleared and it's intentional design decision. Class definition in
Harbour are stored in static variables so if we enable destructor execution
for static variables the we introduce very serious limitation because at
this moment some class may not exists and it's necessary to document that
it's illegal to use any code which may create new object inside destructors.
Such situation is now in xHarbour and I can only guess that author never
thought what he really does.
To enable destructors for static variables we should 1-st change our class
code to protect class objects against releasing before destructors are
executed. Maybe I'll make it in the future. Now it's documented behavior
that at HVM quit state PRG destructors are disabled just before releasing
static variables so programmer does not have to worry that application may
crash if he activates OOP code for class released before.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to