I've just upgraded an application that used Xerces 2.0 to 2.5.  Our SAX
parser derives its own exception class from XMLException.  The default
XMLException constructor sets the memory manager to NULL, and the
XMLException destructor assumes it's not NULL and blindly calls
fMemoryManager->deallocate().  Other member functions (copy constructor,
operator=, setPosition(), and so on) make the same assumption, so the
only safe thing to do would seem to be to use the default memory manager
if the default constructor is called:

XMLException::XMLException() :

    fCode(XMLExcepts::NoError)
    , fSrcFile(0)
    , fSrcLine(0)
    , fMsg(0)
    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
}

It may be that deriving from XMLException is not a great idea.  I could
find no documentation to that effect, not do I recall any recommendation
against it in the 4+ years that I've been participating in the list.
Perhaps such a warning is in order.  In any case, I think making the
suggested change would be safe, cheap, and helpful.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to