You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2003/10/16 13:49:25 UTC

cvs commit: ws-axis/c/src/common ArrayBean.cpp

roshan      2003/10/16 04:49:25

  Modified:    c/src/common ArrayBean.cpp
  Log:
  fixed a problem:
  The engine should not delete the object which are created at the client side, these objects are normaly deleted by the client code. Changed the code to adhere this
  
  Revision  Changes    Path
  1.10      +36 -33    ws-axis/c/src/common/ArrayBean.cpp
  
  Index: ArrayBean.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/ArrayBean.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ArrayBean.cpp	10 Oct 2003 05:13:13 -0000	1.9
  +++ ArrayBean.cpp	16 Oct 2003 11:49:25 -0000	1.10
  @@ -64,6 +64,7 @@
   #include "Param.h"
   #include "ArrayBean.h"
   #include "BasicTypeSerializer.h"
  +#include "../engine/AxisEngine.h"
   
   //////////////////////////////////////////////////////////////////////
   // Construction/Destruction
  @@ -78,45 +79,47 @@
   
   ArrayBean::~ArrayBean()
   {
  -	switch (m_type)
  +	if (USER_TYPE == m_type)
   	{
  -	case XSD_INT:
  +		if (m_value.cta)
   		{
  -			int* a = (int*)m_value.sta;
  -			delete [] a;
  -		}
  -		break;
  -	case XSD_FLOAT:
  -		{
  -			float* a = (float*)m_value.sta;
  -			delete [] a;
  -		}
  -		break;
  -	case XSD_STRING:
  -		{
  -			string* a = (string*)m_value.sta;
  -			delete [] a;
  +			list<int>::iterator it = m_size.begin();
  +			int blocksize = GetArrayBlockSize(it);
  +			if (m_value.cta->pObject)
  +			{
  +				m_value.cta->pDelFunct(m_value.cta->pObject, true, blocksize);
  +				/* make sure that the ComplexObjectHandler's destructor does not try to delete the objects again */
  +				m_value.cta->pObject = NULL;
  +			}
  +			delete m_value.cta;
   		}
  -		break;
  -		//continue this for all basic types
  -	case USER_TYPE: //array of user types
  +	}
  +	else if (AxisEngine::m_bServer)
  +	{
  +		switch (m_type)
   		{
  -			if (m_value.cta)
  +		case XSD_INT:
   			{
  -				list<int>::iterator it = m_size.begin();
  -				int blocksize = GetArrayBlockSize(it);
  -				if (m_value.cta->pObject)
  -				{
  -					m_value.cta->pDelFunct(m_value.cta->pObject, true, blocksize);
  -					/* make sure that the ComplexObjectHandler's destructor does not try to delete the objects again */
  -					m_value.cta->pObject = NULL;
  -				}
  -				delete m_value.cta;
  +				int* a = (int*)m_value.sta;
  +				delete [] a;
   			}
  -		}
  -		break;
  -	default:;
  -	}	
  +			break;
  +		case XSD_FLOAT:
  +			{
  +				float* a = (float*)m_value.sta;
  +				delete [] a;
  +			}
  +			break;
  +		case XSD_STRING:
  +			{
  +				string* a = (string*)m_value.sta;
  +				delete [] a;
  +			}
  +			break;
  +			//continue this for all basic types
  +		default:;
  +		}	
  +	}
   }
   
   int ArrayBean::GetArraySize()