DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4015>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4015

IDDOMImplementation::createDocumentType hopelessly broken

           Summary: IDDOMImplementation::createDocumentType hopelessly
                    broken
           Product: Xerces-C++
           Version: Nightly build
          Platform: Macintosh
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When porting some code from DOM to IDOM I got a segfault when I called
IDDOMImplementation::createDocumentType(). 

Here's the offending bit of code:

    return new IDDocumentTypeImpl(0, qualifiedName, publicId, systemId);

It passes in a null pointer as the ownerDocument to:

IDDocumentTypeImpl::IDDocumentTypeImpl(IDOM_Document *ownerDoc,
                                   const XMLCh *qualifiedName,
                                   const XMLCh *pubId,
                                   const XMLCh *sysId)
        : fNode(ownerDoc),
    fParent(ownerDoc)
{
    IDDocumentImpl *docImpl = (IDDocumentImpl *)ownerDoc;
    publicId = docImpl->cloneString(pubId);
    systemId = docImpl->cloneString(sysId);

At which point it calls cloneString() which attempts to allocate
memory and assign it to the (NULL) ownerDocument ==> segfault.

This code is taken (nearly) verbatim from DOM, where it works because
memory management is handled differently.

How is this every supposed to work for IDOM? Before I create a
Document, I have to first create a DocumentType, but in order to have
one of those the memory must be allocated to an existing
Document...

Catch 22 ...

I would offer a patch but this is hopeless.

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

Reply via email to