2001-10-11 23:05 GMT+1 JFL (mafact) <jfl@mafact.com>

This commit is contained in:
Jean-Francois Lefebvre
2001-10-11 21:04:15 +00:00
parent 12625f5a8e
commit a947b503ce
3 changed files with 55 additions and 11 deletions

View File

@@ -1,3 +1,9 @@
2001-10-11 23:05 GMT+1 JFL (mafact) <jfl@mafact.com>
* harbour/source/vm/classes.c
* harbour/source/vm/hvm.c
* Changed the way I allocate/reallocate and xfree 'puiClstree' pointer
to solve unreleased memory blocks ...
2001-10-11 21:45 GMT+3 Alexander Kresin <alex@belacy.belgorod.su>
! source/pp/pptable.c
* Rule corrected

View File

@@ -639,7 +639,7 @@ char * hb_objGetRealClsName( PHB_ITEM pObject, char * szName )
uiClass = pObject->item.asArray.value->uiClass;
/* default value to current class object */
if (pObject->item.asArray.value->puiClsTree[0])
if (pObject->item.asArray.value->puiClsTree && pObject->item.asArray.value->puiClsTree[0])
{
uiClsTree = pObject->item.asArray.value->puiClsTree[0] ;
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
@@ -1437,8 +1437,10 @@ static PHB_ITEM hb_clsInst( USHORT uiClass )
pSelf->item.asArray.value->uiClass = uiClass;
pSelf->item.asArray.value->uiPrevCls = 0;
pSelf->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) );
pSelf->item.asArray.value->puiClsTree[0]=0;
pSelf->item.asArray.value->puiClsTree = NULL;
//pSelf->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) );
//pSelf->item.asArray.value->puiClsTree[0]=0;
/* Initialise value if initialisation was requested */
pMeth = pClass->pMethods;
@@ -1639,8 +1641,11 @@ HB_FUNC( __OBJCLONE )
if( pSrcObject )
{
pDstObject= hb_arrayClone( pSrcObject, NULL ) ;
pDstObject->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) );
pDstObject->item.asArray.value->puiClsTree[0]=0;
pDstObject->item.asArray.value->puiClsTree = NULL;
//pDstObject->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) );
//pDstObject->item.asArray.value->puiClsTree[0]=0;
hb_itemRelease( hb_itemReturn( pDstObject ) );
}
else

View File

@@ -3025,6 +3025,12 @@ void hb_vmDo( USHORT uiParams )
/* Push current SuperClass handle */
lPopSuper = TRUE ;
if ( ! pSelf->item.asArray.value->puiClsTree)
{
pSelf->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) );
pSelf->item.asArray.value->puiClsTree[0]=0;
}
nPos=pSelfBase->puiClsTree[0]+1;
pSelfBase->puiClsTree = ( USHORT * ) hb_xrealloc( pSelfBase->puiClsTree, sizeof( USHORT ) * ( nPos + 1 ) );
@@ -3042,12 +3048,22 @@ void hb_vmDo( USHORT uiParams )
pFunc();
if (lPopSuper)
if (lPopSuper && pSelfBase->puiClsTree)
{
USHORT nPos=pSelfBase->puiClsTree[0]-1;
/* POP SuperClass handle */
pSelfBase->puiClsTree = ( USHORT * ) hb_xrealloc( pSelfBase->puiClsTree, sizeof( USHORT ) * (nPos + 1) );
pSelfBase->puiClsTree[0]=nPos;
if (nPos)
{
pSelfBase->puiClsTree = ( USHORT * ) hb_xrealloc( pSelfBase->puiClsTree, sizeof( USHORT ) * (nPos + 1) );
pSelfBase->puiClsTree[0]=nPos;
}
else
{
hb_xfree(pSelfBase->puiClsTree);
pSelfBase->puiClsTree = NULL ;
}
}
@@ -3170,6 +3186,14 @@ void hb_vmSend( USHORT uiParams )
/* Push current SuperClass handle */
lPopSuper = TRUE ;
if ( ! pSelf->item.asArray.value->puiClsTree)
{
pSelf->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) );
pSelf->item.asArray.value->puiClsTree[0]=0;
}
nPos=pSelfBase->puiClsTree[0]+1;
pSelfBase->puiClsTree = ( USHORT * ) hb_xrealloc( pSelfBase->puiClsTree, sizeof( USHORT ) * (nPos+1) ) ;
pSelfBase->puiClsTree[0] = nPos ;
@@ -3183,12 +3207,21 @@ void hb_vmSend( USHORT uiParams )
pFunc();
if (lPopSuper)
if (lPopSuper && pSelfBase->puiClsTree)
{
USHORT nPos=pSelfBase->puiClsTree[0]-1;
/* POP SuperClass handle */
pSelfBase->puiClsTree = ( USHORT * ) hb_xrealloc( pSelfBase->puiClsTree, sizeof( USHORT ) * (nPos + 1) );
pSelfBase->puiClsTree[0]=nPos;
if (nPos)
{
pSelfBase->puiClsTree = ( USHORT * ) hb_xrealloc( pSelfBase->puiClsTree, sizeof( USHORT ) * (nPos + 1) );
pSelfBase->puiClsTree[0]=nPos;
}
else
{
hb_xfree(pSelfBase->puiClsTree);
pSelfBase->puiClsTree = NULL ;
}
}
if( bProfiler )