[xsd-users] access violation with --generate-wildcards

Rizzuto, Raymond Raymond.Rizzuto at sig.com
Fri Jun 27 16:15:57 EDT 2008


Hi!

I was compiling my code as follows:

xsd.exe cxx-tree  --output-dir . --hxx-suffix .hxx --cxx-suffix .cxx --ixx-suffix .ixx --fwd-suffix -fwd.hxx --generate-serialization --generate-polymorphic --generate-ostream --generate-comparison --generate-intellisense --type-naming ucc --function-naming lcc --root-element-all

I decided to add -generate-wildcards.  Now I take an unhandled exception:

Unhandled exception at 0x1200987a (xerces-c_2_8D_vc80.dll) in SDMPTest.exe: 0xC0000005: Access violation reading location 0x00000000.

            xerces-c_2_8D_vc80.dll!xercesc_2_8::XMLMutex::lock()  Line 60 + 0x3 bytes       C++
            xerces-c_2_8D_vc80.dll!xercesc_2_8::XMLMutexLock::XMLMutexLock(xercesc_2_8::XMLMutex * const toLock=0x00000000)  Line 78     C++
            xerces-c_2_8D_vc80.dll!xercesc_2_8::getDOMImplSrcVectorMutex()  Line 90 + 0xe bytes            C++
            xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMImplementationRegistry::getDOMImplementation(const wchar_t * features=0x0012f35c)  Line 123 + 0x5 bytes       C++
            SDMPTest.exe!xsd::cxx::xml::dom::create_document<char>()  Line 30 + 0xc bytes         C++
            SDMPTest.exe!sdmp::messages::ObjectId::ObjectId(const char * String=0x007f8e4c, const sdmp::messages::SystemId & source={...}, const int & revision=3)  Line 11393 + 0x71 bytes        C++
            SDMPTest.exe!wmain(int argc=1, wchar_t * * argv=0x00366b40)  Line 16 + 0x3c bytes     C++
            SDMPTest.exe!__tmainCRTStartup()  Line 594 + 0x19 bytes        C
            SDMPTest.exe!wmainCRTStartup()  Line 414      C
            kernel32.dll!7c816fd7()
            [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]

This is happening in the constructor call for my object:

    DomainObject::IdType test("request-1", "SusexToSDMP", 3);

Id in DomainObject is of type ObjectId, defined as follows:

            <xs:complexType name="ObjectId">
                        <xs:simpleContent>
                                    <xs:extension base="xs:string">
                                                <xs:attribute name="source" type="SystemId" use="required">
                                                </xs:attribute>
                                                <xs:attribute name="revision" type="xs:int" use="required">
                                                </xs:attribute>
                                                <xs:anyAttribute namespace="##targetNamespace">
                                                            <xs:annotation>
                                                                        <xs:documentation>Additional attributes may be added in future revisions.</xs:documentation>
                                                            </xs:annotation>
                                                </xs:anyAttribute>
                                    </xs:extension>
                        </xs:simpleContent>
            </xs:complexType>

I was able to find the answer in the manual, and added the calls to    xercesc::XMLPlatformUtils::Initialize ();  and    xercesc::XMLPlatformUtils::Terminate ();

However, with this change, I got an exception on my app exit.   Turned out to be my fault.  Basically the code was:

main()
{
    xercesc::XMLPlatformUtils::Initialize ();
    DomainObject::IdType test("request-1", "SusexToSDMP", 3);
        .
        .
        .
    xercesc::XMLPlatformUtils::Terminate ();
}

The crash was like this:

            xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::deleteHeap()  Line 884 + 0x1d bytes            C++
            xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::~DOMDocumentImpl()  Line 208    C++
            xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::`vector deleting destructor'()  + 0x50 bytes            C++
            xerces-c_2_8D_vc80.dll!xercesc_2_8::DOMDocumentImpl::release()  Line 1367 + 0x20 bytes     C++
            SDMPTest.exe!xsd::cxx::xml::dom::auto_ptr<xercesc_2_8::DOMDocument>::reset(xercesc_2_8::DOMDocument * x=0x00000000)  Line 145 + 0x1c bytes         C++
             SDMPTest.exe!xsd::cxx::xml::dom::auto_ptr<xercesc_2_8::DOMDocument>::~auto_ptr<xercesc_2_8::DOMDocument>()  Line 50         C++
            SDMPTest.exe!sdmp::messages::ObjectId::~ObjectId()  Line 11512 + 0x29 bytes C++
            SDMPTest.exe!wmain(int argc=1, wchar_t * * argv=0x00366b40)  Line 120 + 0x19 bytes            C++

Obviously, terminating xerces and then destructing the object was an issue.  I changed the code to:

main()
{
    xercesc::XMLPlatformUtils::Initialize ();
    {
        DomainObject::IdType test("request-1", "SusexToSDMP", 3);
                .
                .
                .
        }
    xercesc::XMLPlatformUtils::Terminate ();
}

Anyway, just wanted to pass along the information in case others run into this issue.

Ray

________________________________
Ray Rizzuto
raymond.rizzuto at sig.com
Susquehanna International Group
(610)747-2336 (W)
(215)776-3780 (C)



________________________________
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.



More information about the xsd-users mailing list