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 "David C." <xe...@buir.de> on 2003/01/27 14:25:18 UTC

core dump in XMLPlatformUtils::Terminate(); and XMLPlatformUtils::Initialize();

Hi !
this code coredumps on solaris 2.7 using libxerces-c v2.1 in the first call
to method Terminate .

debugger output:
=============

(gdb) backtrace
#0  0x0 in ?? ()
#1  0xff15d6fc in reinitImplementation () from
/sw/local/develsup/xerces/xercesc_2_1_0Sol2.7ForCC/lib/libxerces-c.so.21
#2  0xff19b880 in XMLPlatformUtils::Terminate () from
/sw/local/develsup/xerces/xercesc_2_1_0Sol2.7ForCC/lib/libxerces-c.so.21
#3  0x10a3c in main ()

sourcecode:
==========

#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOMException.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/validators/common/Grammar.hpp>
#include <xercesc/framework/StdOutFormatTarget.hpp>
#include <xercesc/framework/MemBufFormatTarget.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
#include <string>

int main(int argc,char** argv)
{
   std::cout << "init" << std::endl;
   XMLPlatformUtils::Initialize();
   {
   XMLCh tempStr[4];
   XMLString::transcode("LS", tempStr, 3);

   XMLCh schemaTyp[35];
   XMLString::transcode("http://www.w3.org/2001/XMLSchema",schemaTyp,34);
   DOMImplementation* pDomImpl=
DOMImplementationRegistry::getDOMImplementation(tempStr);
//   DOMBuilder* pParser =
pDomImpl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0);
//   DOMWriter*  pWriter = pDomImpl->createDOMWriter();


//   delete pParser;
//   delete pWriter;
   delete pDomImpl;
   }
   std::cout << "terminate" << std::endl;
   XMLPlatformUtils::Terminate();
   std::cout << "init2" << std::endl;
   XMLPlatformUtils::Initialize();
   std::cout << "terminate2" << std::endl;
   XMLPlatformUtils::Terminate();
   return 0;
}


but this code works:
===============

#include <xercesc/util/PlatformUtils.hpp>
#include <string>

int main(int argc,char** argv)
{
   std::cout << "init" << std::endl;
   XMLPlatformUtils::Initialize();
   std::cout << "terminate" << std::endl;
   XMLPlatformUtils::Terminate();
   std::cout << "init2" << std::endl;
   XMLPlatformUtils::Initialize();
   std::cout << "terminate2" << std::endl;
   XMLPlatformUtils::Terminate();
   return 0;
}

is this fixed in a later version of xerces-c ?

Thanks and greetings
  david c.

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


Re: core dump in XMLPlatformUtils::Terminate(); and XMLPlatformUtils::Initialize();

Posted by "david c." <xe...@buir.de>.
Thanks !!
I'll try it tomorrow morning !

greetings and a nice evening
 David C.

----- Original Message -----
From: Tinny Ng <tn...@ca.ibm.com>
To: <xe...@xml.apache.org>; David C. <xe...@buir.de>
Sent: Monday, January 27, 2003 8:38 PM
Subject: Re: core dump in XMLPlatformUtils::Terminate(); and
XMLPlatformUtils::Initialize();


> David,
>
> Please do not delete:
>     delete pDomImpl;
>
> You do not need to delete any DOM object returned from DOM.   You can call
> release() to release any "orphaned" resources that weree created by
factory
> method createXXXX.   see
> http://xml.apache.org/xerces-c/ApacheDOMC++BindingL2.html for more
details.
>
> Tinny
>
> ----- Original Message -----
> From: "David C." <xe...@buir.de>
> To: <xe...@xml.apache.org>
> Sent: Monday, January 27, 2003 8:25 AM
> Subject: core dump in XMLPlatformUtils::Terminate(); and
> XMLPlatformUtils::Initialize();
>
>
> > Hi !
> > this code coredumps on solaris 2.7 using libxerces-c v2.1 in the first
> call
> > to method Terminate .
> >
> > debugger output:
> > =============
> >
> > (gdb) backtrace
> > #0  0x0 in ?? ()
> > #1  0xff15d6fc in reinitImplementation () from
> > /sw/local/develsup/xerces/xercesc_2_1_0Sol2.7ForCC/lib/libxerces-c.so.21
> > #2  0xff19b880 in XMLPlatformUtils::Terminate () from
> > /sw/local/develsup/xerces/xercesc_2_1_0Sol2.7ForCC/lib/libxerces-c.so.21
> > #3  0x10a3c in main ()
> >
> > sourcecode:
> > ==========
> >
> > #include <xercesc/parsers/XercesDOMParser.hpp>
> > #include <xercesc/sax/HandlerBase.hpp>
> > #include <xercesc/dom/DOM.hpp>
> > #include <xercesc/dom/DOMNode.hpp>
> > #include <xercesc/dom/DOMException.hpp>
> > #include <xercesc/util/XMLString.hpp>
> > #include <xercesc/util/PlatformUtils.hpp>
> > #include <xercesc/validators/common/Grammar.hpp>
> > #include <xercesc/framework/StdOutFormatTarget.hpp>
> > #include <xercesc/framework/MemBufFormatTarget.hpp>
> > #include <xercesc/framework/MemBufInputSource.hpp>
> > #include <string>
> >
> > int main(int argc,char** argv)
> > {
> >    std::cout << "init" << std::endl;
> >    XMLPlatformUtils::Initialize();
> >    {
> >    XMLCh tempStr[4];
> >    XMLString::transcode("LS", tempStr, 3);
> >
> >    XMLCh schemaTyp[35];
> >
XMLString::transcode("http://www.w3.org/2001/XMLSchema",schemaTyp,34);
> >    DOMImplementation* pDomImpl=
> > DOMImplementationRegistry::getDOMImplementation(tempStr);
> > //   DOMBuilder* pParser =
> > pDomImpl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0);
> > //   DOMWriter*  pWriter = pDomImpl->createDOMWriter();
> >
> >
> > //   delete pParser;
> > //   delete pWriter;
> >    delete pDomImpl;
> >    }
> >    std::cout << "terminate" << std::endl;
> >    XMLPlatformUtils::Terminate();
> >    std::cout << "init2" << std::endl;
> >    XMLPlatformUtils::Initialize();
> >    std::cout << "terminate2" << std::endl;
> >    XMLPlatformUtils::Terminate();
> >    return 0;
> > }
> >
> >
> > but this code works:
> > ===============
> >
> > #include <xercesc/util/PlatformUtils.hpp>
> > #include <string>
> >
> > int main(int argc,char** argv)
> > {
> >    std::cout << "init" << std::endl;
> >    XMLPlatformUtils::Initialize();
> >    std::cout << "terminate" << std::endl;
> >    XMLPlatformUtils::Terminate();
> >    std::cout << "init2" << std::endl;
> >    XMLPlatformUtils::Initialize();
> >    std::cout << "terminate2" << std::endl;
> >    XMLPlatformUtils::Terminate();
> >    return 0;
> > }
> >
> > is this fixed in a later version of xerces-c ?
> >
> > Thanks and greetings
> >   david c.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


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


Re: core dump in XMLPlatformUtils::Terminate(); and XMLPlatformUtils::Initialize();

Posted by Tinny Ng <tn...@ca.ibm.com>.
David,

Please do not delete:
    delete pDomImpl;

You do not need to delete any DOM object returned from DOM.   You can call
release() to release any "orphaned" resources that weree created by factory
method createXXXX.   see
http://xml.apache.org/xerces-c/ApacheDOMC++BindingL2.html for more details.

Tinny

----- Original Message -----
From: "David C." <xe...@buir.de>
To: <xe...@xml.apache.org>
Sent: Monday, January 27, 2003 8:25 AM
Subject: core dump in XMLPlatformUtils::Terminate(); and
XMLPlatformUtils::Initialize();


> Hi !
> this code coredumps on solaris 2.7 using libxerces-c v2.1 in the first
call
> to method Terminate .
>
> debugger output:
> =============
>
> (gdb) backtrace
> #0  0x0 in ?? ()
> #1  0xff15d6fc in reinitImplementation () from
> /sw/local/develsup/xerces/xercesc_2_1_0Sol2.7ForCC/lib/libxerces-c.so.21
> #2  0xff19b880 in XMLPlatformUtils::Terminate () from
> /sw/local/develsup/xerces/xercesc_2_1_0Sol2.7ForCC/lib/libxerces-c.so.21
> #3  0x10a3c in main ()
>
> sourcecode:
> ==========
>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/sax/HandlerBase.hpp>
> #include <xercesc/dom/DOM.hpp>
> #include <xercesc/dom/DOMNode.hpp>
> #include <xercesc/dom/DOMException.hpp>
> #include <xercesc/util/XMLString.hpp>
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/validators/common/Grammar.hpp>
> #include <xercesc/framework/StdOutFormatTarget.hpp>
> #include <xercesc/framework/MemBufFormatTarget.hpp>
> #include <xercesc/framework/MemBufInputSource.hpp>
> #include <string>
>
> int main(int argc,char** argv)
> {
>    std::cout << "init" << std::endl;
>    XMLPlatformUtils::Initialize();
>    {
>    XMLCh tempStr[4];
>    XMLString::transcode("LS", tempStr, 3);
>
>    XMLCh schemaTyp[35];
>    XMLString::transcode("http://www.w3.org/2001/XMLSchema",schemaTyp,34);
>    DOMImplementation* pDomImpl=
> DOMImplementationRegistry::getDOMImplementation(tempStr);
> //   DOMBuilder* pParser =
> pDomImpl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0);
> //   DOMWriter*  pWriter = pDomImpl->createDOMWriter();
>
>
> //   delete pParser;
> //   delete pWriter;
>    delete pDomImpl;
>    }
>    std::cout << "terminate" << std::endl;
>    XMLPlatformUtils::Terminate();
>    std::cout << "init2" << std::endl;
>    XMLPlatformUtils::Initialize();
>    std::cout << "terminate2" << std::endl;
>    XMLPlatformUtils::Terminate();
>    return 0;
> }
>
>
> but this code works:
> ===============
>
> #include <xercesc/util/PlatformUtils.hpp>
> #include <string>
>
> int main(int argc,char** argv)
> {
>    std::cout << "init" << std::endl;
>    XMLPlatformUtils::Initialize();
>    std::cout << "terminate" << std::endl;
>    XMLPlatformUtils::Terminate();
>    std::cout << "init2" << std::endl;
>    XMLPlatformUtils::Initialize();
>    std::cout << "terminate2" << std::endl;
>    XMLPlatformUtils::Terminate();
>    return 0;
> }
>
> is this fixed in a later version of xerces-c ?
>
> Thanks and greetings
>   david c.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


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