On Tue, 04 Mar 2008, Teo Fonrouge wrote:
> Hello,
> In a set of inherited classes, the DESTRUCTOR procedure is called more than 
> one time if a parent class, has a DESTRUCTOR.
> I think that this is incorrect behavior. Acceptable only when each parent 
> class has his own DESTRUCTOR.

Below is patch which fixes it. I'll commit it after new release.

best regards,
Przemek


Index: harbour/source/vm/classes.c
===================================================================
--- harbour/source/vm/classes.c (wersja 8313)
+++ harbour/source/vm/classes.c (kopia robocza)
@@ -2041,11 +2041,20 @@
    {
       if( pbClasses[ uiClass ] == 1 )
       {
-         hb_vmPushSymbol( &s___msgDestructor );
-         hb_clsMakeSuperObject( hb_stackAllocItem(), pObject, uiClass );
-         hb_vmSend( 0 );
-         if( hb_vmRequestQuery() != 0 )
-            break;
+         PMETHOD pDestructor = hb_clsFindMsg( &s_pClasses[ uiClass ],
+                                              s___msgDestructor.pDynSym );
+         if( pDestructor )
+         {
+            if( pbClasses[ pDestructor->uiSprClass ] == 1 )
+            {
+               hb_vmPushSymbol( &s___msgDestructor );
+               hb_clsMakeSuperObject( hb_stackAllocItem(), pObject, uiClass );
+               hb_vmSend( 0 );
+               if( hb_vmRequestQuery() != 0 )
+                  break;
+               pbClasses[ pDestructor->uiSprClass ] |= 2;
+            }
+         }
       }
    }
 
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to