Example #1
0
/*=============================================================================
FUNCTION: CVector_Release

DESCRIPTION:

PARAMETERS:
	*iv: IVector interface pointer

RETURN VALUE:
uint32: 

COMMENTS:

SIDE EFFECTS:

SEE ALSO:

=============================================================================*/
static uint32 CVector_Release(IVector *iv)
{
   CVector *pMe = (CVector*)iv;

   ASSERT(pMe != NULL);
   if (0 == pMe->m_nRefs) {
      return 0;
   }

   if (--pMe->m_nRefs) {
      return pMe->m_nRefs;
   }

   CVector_FreeData(pMe);
   (void) IMODULE_Release(pMe->m_pModule);

   OEM_Free(pMe);
   return 0;
}
// ================================================================================
// FUNCTION		: SyncEngExt_Release
// DESCRIPTION	: This function decreases the reference count for the SyncEngExt object. If
//				: the reference count reaches zero, it does the required cleanup
// ================================================================================
static uint32 SyncEngExt_Release(ISyncEngExt * po)
{
	SyncEngExt *		pMe = (SyncEngExt *)po;

	//release member variable data
	if ( NULL!=pMe->m_pContHandler ) delete pMe->m_pContHandler;

	if( --pMe->m_nRefs != 0 )
		return pMe->m_nRefs;

	// Ref count is zero. So, release memory associated with this object.

	// Release interfaces
	ISHELL_Release(pMe->m_pIShell);
	IMODULE_Release(pMe->m_pIModule);
	//Free the object itself
	FREE_VTBL(pMe, IModule);
	FREE( pMe );

	return 0;
}