On Wed, Apr 11, 2001 at 12:31:58PM -0400, [EMAIL PROTECTED] wrote:
> 
> >Why can't I 'new' dom objects? Is this wrong practise
> >unconditionally, or I only must be very careful?
> 
> Wrong practice pretty much unconditionally, unless you're a parser or
> otherwise need to access things in ways that the DOM APIs explicitly forbid
> for normal applications. The factory methods may preform initializations or
> have other side-effects that the c'tors don't, and public c'tors are _NOT_
> part of the offical DOM API and will not be the same or supported in all
> DOM implementations.
> 
Again, I am not going to 'new' DOM objects here and there

What about the folloing example

extern "C" void * startDOM(some, parameters)
{
        .............
        DOM_Document dom=domImpl.createDocument(...);
        DOM_Document *pdom=new DOM_Document;
        *pdom=dom; //I hope reference count=2  at this point
                   // didn't read all the code yet

        return (void*)pdom;
        // dom destroyed, RC=1
}
extern "C" domProcess(void *pvdom,some, thing ,to , do)
{
        DOM_Document pdom=(DOM_Document*)pvdom ; // RC still is 1
        
        do things as usual

}

extern "C" domFinish(void *pvdom)
{
        DOM_Document pdom=(DOM_Document*)pvdom ; // RC still is 1
        
        delete pdom ;// I hope this is the same as dom local variable
                     // go out of scope; RC=0

}

What is wrong with this example?

-- 
Sincerely Yours, Konstantin Kivi, Russia, [EMAIL PROTECTED]


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

Reply via email to