You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by kintaroe <ru...@synarea.com> on 2013/02/27 17:51:43 UTC

Exception when calling parse from release - build (3.1.1)

Hello ladies and gentlemen,

I would like to reopen  this
<http://apache-xml.6118.n7.nabble.com/Exception-when-calling-parse-from-release-build-tp4038.html>  
thread because I have the same problem, I summarize it briefly.

I made a function that:

- calls XMLPlatformUtils::Initialize();
- creates a SAXParser
- assigns a simple HandlerBase as DocumentHandler and ErrorHandler
- calls SAXParser::Parse with a file.

In Release mode, the Parse method gives me Access Violation, while in Debug
works fine.

The call stack is:
ntdll.dll!77d015de() 
_VEC_memzero(void * dst=0x002c3578, int val=2160640, int len=2160704)  +
0x82 byte	C
xercesc_3_1::XMLBufferMgr::bidOnBuffer()  Line 62 + 0xc byte	C++
xercesc_3_1::XMLScanner::resetUIntPool()  Line 2294 + 0x12 byte	C++
xercesc_3_1::XMLScanner::scanProlog()  Line 1230 + 0x13 byte	C++

In the attachment  Crash_sample.zip
<http://apache-xml.6118.n7.nabble.com/file/n39813/Crash_sample.zip>   you
will find the Visual Studio 2008 solution with the simple function to test.

The previous thread seemed to solve by changing the runtime library to Dll
Multithreaded, but for me it didn't work.

I link statically to the 3.1.1 version of xerces, on Windows 7, with Visual
Studio 2008. 
I also tried to link the dll version, but nothing changed. 
I tried to rebuild xerces on my machine, but nothing changed.

What else can I do? What am I missing? Any hint will be appreciated.

Thanks in advance,
Kintaroe




--
View this message in context: http://apache-xml.6118.n7.nabble.com/Exception-when-calling-parse-from-release-build-3-1-1-tp39813.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Solved: Exception when calling parse from release - build (3.1.1)

Posted by kintaroe <ru...@synarea.com>.
Hi everybody, I solved. 

The error was in mismatched upcast. I wrote

HandlerBase* pkDocumentHandler = new HandlerBase();
DocumentHandler* docHandler = pkDocumentHandler;

ErrorHandler* errHandler = (ErrorHandler*) docHandler; //error in cast

instead of

ErrorHandler* errHandler = (ErrorHandler*) pkDocumentHandler;


3 Days to find it... grrrrrr! 





--
View this message in context: http://apache-xml.6118.n7.nabble.com/Exception-when-calling-parse-from-release-build-3-1-1-tp39813p39825.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.