Message:
The following issue has been closed.
Resolver: Alberto Massari
Date: Thu, 2 Sep 2004 9:34 AM
This is a user error, not a bug; you created a Wrapper4InputSource without specifying
"false" as the second argument (adoptFlag), that has a default value of "true"; so
when the temp object went out of scope it deleted the InputSource and you are doing a
double delete.
Alberto
---------------------------------------------------------------------
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: Closed
Priority: Major
Resolution: INCOMPLETE
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:34 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]