The following comment has been added to this issue: Author: David Bertoni Created: Thu, 2 Sep 2004 9:31 AM Body: The constructor declaration for Wrapper4InputSource tells you what the problem is:
Wrapper4InputSource(InputSource* const inputSource , const bool adoptFlag = true , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); Wrapper4InputSource adopts the wrapped InputSource by default (maybe not the best choice from a design perspective, but there you go...) So, your InputSource has already been deleted when you try to delete it, which leads to undefined behavior. Solaris doesn't crash right away, but you've probably corrupted the heap, which would lead to trouble later in your program. So, this is not a bug in Xerces-C. --------------------------------------------------------------------- View this comment: http://issues.apache.org/jira/browse/XERCESC-1268?page=comments#action_39520 --------------------------------------------------------------------- View the issue: http://issues.apache.org/jira/browse/XERCESC-1268 Here is an overview of the issue: --------------------------------------------------------------------- Key: XERCESC-1268 Summary: MemBufInputSource assertion on membuf delete Type: Bug Status: Unassigned Priority: Major Project: Xerces-C++ Components: Utilities Versions: 2.5.0 Assignee: Reporter: Igor Mammedov Created: Thu, 2 Sep 2004 9:20 AM Updated: Thu, 2 Sep 2004 9:31 AM Environment: Red Hat Enterprise Linux ES release 3 (Taroon) gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20) xerces-c-2.5.0-0.20040818.1mdk.src.rpm Description: I have next trouble when I delete dinamicaly created MemBufInputSource I get following assertion message: XMemory.cpp:121: static void xercesc_2_5::XMemory::operator delete(void*): Assertion `manager != 0' failed. Here is example code to reproduce bug: ----------------------- cut -------------------------------------- #include <xercesc/dom/DOM.hpp> #include <xercesc/framework/StdOutFormatTarget.hpp> #include <xercesc/framework/LocalFileFormatTarget.hpp> #include <xercesc/framework/MemBufFormatTarget.hpp> #include <xercesc/framework/Wrapper4InputSource.hpp> #include <xercesc/util/XMLString.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <xercesc/framework/MemBufInputSource.hpp> #ifdef XERCES_CPP_NAMESPACE_USE XERCES_CPP_NAMESPACE_USE #endif int main(int argc, int argv){ try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { return 1; } XMLCh tempStr[100]; XMLString::transcode("LS", tempStr, 99); DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr); DOMBuilder* parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); char* tmp_buf = new char[1000]; strcpy(tmp_buf,"<test><tag>fdf</tag></test>"); const char* gMemBufId = "prodInfo"; MemBufInputSource* memBufIS = new MemBufInputSource( ( XMLByte*)tmp_buf , strlen(tmp_buf), gMemBufId, false ); DOMDocument *doc = parser->parse(Wrapper4InputSource(memBufIS)); <--comment here to avoid assertion delete memBufIS; <---- crash here return 0; } ----------------------- cut -------------------------------------- This code works on solaris but rise assertion on linux. It doesn't matter whether you addopt buffer or not, assertion happens anyway. But it all works fine if we do nothing with memBufIS ( for example: comment parse method). Current work around is to avoid deletion of memBufIS (memory leak :( ). --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]