Ron: I found a problem when destructor should be executed from method of super class. This entry in ChangeLog.020 is when actual code was added.
2004-05-10 01:52 UTC-0800 Ron Pinkas <r...@ronpinkas.com> * source/vm/classes.c + Added logic to disallow Destructor calls on faked super objects, as well as temp super objects created with __clsInstSuper() The code that causes the problem in hb_clsFinalize() function is: if( HB_IS_SYMBOL( hb_stackBaseItem() ) && hb_stackBaseItem()->item.asSymbol.pCargo->uiSuperClass == 0 && strcmp( hb_stackBaseItem()->item.asSymbol.value->szName, "__CLSINSTSUPER" ) ) The next code demonstrates the problem: destructor of TMyClass( 2 ) is not executed destruc2.prg //------------------------------------------------------------------------------------------ #include "hbclass.ch" PROCEDURE MAIN() LOCAL oVar := TMyClass(7), oVar1 := TMyClass2( 8 ) oVar:oVar2 := TMyClass( 1 ) oVar1:oVar2 := TMyClass( 2 ) // destructor of TMyClass( 2 ) is not executed oVar1:oVar3 := TMyClass( 3 ) // cleaning return area because contain the TMyClass( 3 ) object and // destructors preserve the return area when that are executed tracelog("cleaning return area") oVar := nil oVar1 := nil tracelog("end") RETURN CLASS TMyClass DATA nVar DATA oVar2 METHOD NEW( nVar ) CONSTRUCTOR METHOD Cleanup() DESTRUCTOR MyDestructor ENDCLASS PROCEDURE MyDestructor CLASS TMyClass ::CleanUp() RETURN METHOD CleanUp() CLASS TMyClass if ::oVar2 != nil TraceLog(::nVar,::oVar2:nVar) else TraceLog(::nVar) endif ::oVar2 := nil ? "Cleanup:", ::nVar RETURN nil METHOD New( nVar ) CLASS TMyClass ::nVar := nVar RETURN Self CLASS TMyClass2 From TMyClass DATA oVar3 METHOD CleanUp() ENDCLASS METHOD Cleanup()CLASS TMyClass2 if ::oVar3 != nil TraceLog(::nVar,::oVar3:nVar) endif ::oVar3 := nil super:cleanup() RETURN NIL ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ xHarbour-developers mailing list xHarbour-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xharbour-developers