You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Nathan Smith <Na...@Paxar.com> on 2004/03/18 19:38:17 UTC

memory corruption when deleting the SAXParser

 
I am developing in VC++6.0 with the latest service pack and using
xerces-c_1_6_0D.dll.  I'm having a problem with memory corruption when I try
to delete the parser object.  Any ideas?  Thanks.
 
try
 {
  XMLPlatformUtils::Initialize();
 }
 catch (const XMLException& er)
 {
  AfxMessageBox(CString(er.getMessage()));
  return 0;
 }
 SAXParser* parser = new SAXParser;
  
 try
 {
  parser->setValidationScheme(SAXParser::Val_Never);
  CSaxHandlers handler("");
  PaxarSAXErrorHandler error;
  parser->setDocumentHandler(&handler);
  parser->setErrorHandler(&error);
  parser->parse(path.GetBuffer(0));
  path.ReleaseBuffer(0);
  delete parser;
 }
 catch(const SAXException& de)
 {
  delete parser;  
  XMLPlatformUtils::Terminate();
  AfxMessageBox(CString(de.getMessage()));
  return 0;
 }
 catch(const XMLException& e)
 {
  delete parser;
  XMLPlatformUtils::Terminate();
  AfxMessageBox(CString(e.getMessage()));
  return 0;
 }
 
 XMLPlatformUtils::Terminate();

Re: memory corruption when deleting the SAXParser

Posted by Alberto Massari <am...@progress.com>.
Hi Nathan,
what is the code for your CSaxHandlers class? Maybe the corruption is there

Alberto

At 13.38 18/03/2004 -0500, Nathan Smith wrote:
>
>I am developing in VC++6.0 with the latest service pack and using 
>xerces-c_1_6_0D.dll.  I'm having a problem with memory corruption when I 
>try to delete the parser object.  Any ideas?  Thanks.
>
>try
>  {
>   XMLPlatformUtils::Initialize();
>  }
>  catch (const XMLException& er)
>  {
>   AfxMessageBox(CString(er.getMessage()));
>   return 0;
>  }
>  SAXParser* parser = new SAXParser;
>
>  try
>  {
>   parser->setValidationScheme(SAXParser::Val_Never);
>   CSaxHandlers handler("");
>   PaxarSAXErrorHandler error;
>   parser->setDocumentHandler(&handler);
>   parser->setErrorHandler(&error);
>   parser->parse(path.GetBuffer(0));
>   path.ReleaseBuffer(0);
>   delete parser;
>  }
>  catch(const SAXException& de)
>  {
>   delete parser;
>   XMLPlatformUtils::Terminate();
>   AfxMessageBox(CString(de.getMessage()));
>   return 0;
>  }
>  catch(const XMLException& e)
>  {
>   delete parser;
>   XMLPlatformUtils::Terminate();
>   AfxMessageBox(CString(e.getMessage()));
>   return 0;
>  }
>
>  XMLPlatformUtils::Terminate();



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org