Hey All,

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.

jas.

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

Reply via email to