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=16397>.
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=16397

XObjectFactoryDefault::::reset() don't clear m_xstringCache

           Summary: XObjectFactoryDefault::::reset() don't clear
                    m_xstringCache
           Product: XalanC
           Version: 1.4.x
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: XPathC
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When I use the sample SimpleXPathAPI with a small modification:

    for(int i = 0; i < 3; i++) // Add a loop to get the same path 3 times
    {
        // OK, let's evaluate the expression...
        const XObjectPtr        theResult(
                                        theEvaluator.evaluate(
                                        theDOMSupport,
                                        theContextNode,
                                        XalanDOMString(argv[3]).c_str(),
                                        theDocument->getDocumentElement()));

        assert(theResult.null() == false);

        cout << "The string value of the result is:"
             << endl
             << theResult->str()
             << endl
             << endl;
    }

With a simple path like:
shiporder/item/price 
the sample work fine.

With a more complex path like:
shiporder/item[@number=\"2\"]/price[@area=\"asia\"]
I get an assert on the second time in the loop.

I try to debug it an I find something in:
XObjectFactoryDefault::reset()
{
        m_xstringAdapterAllocator.reset();

        m_xstringAllocator.reset(); //Was reseted
       // but not m_xstringCache.clear();

        m_xstringReferenceAllocator.reset();

        m_xnumberAllocator.reset();

        m_xnodesetAllocator.reset();

#if !defined(XALAN_NO_NAMESPACES)
        using std::for_each;
#endif

        for_each(m_xobjects.begin(),
                         m_xobjects.end(),
                         DeleteXObjectFunctor(*this, true));

        m_xobjects.clear();

        m_xnumberCache.clear();

        m_xnodesetCache.clear();

       // m_xstringCache.clear();?
}

If I clear m_xstringCache the sample work fine

Reply via email to