-
Type:
Bug
-
Status: Resolved
-
Resolution: Duplicate
-
Affects Version/s: 1.4.x
-
Fix Version/s: None
-
Component/s: XPathC
-
Labels:None
-
Environment:Operating System: Windows NT/2K
Platform: PC
-
Bugzilla Id:16397
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