xml-xalan-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject svn commit: r990403 - in /xalan/c/trunk/src/xalanc: XPath/XObjectFactory.hpp XPath/XObjectFactoryDefault.cpp XPath/XObjectFactoryDefault.hpp XalanExtensions/FunctionNodeSet.cpp
Date Sat, 28 Aug 2010 18:28:34 GMT
Author: dbertoni
Date: Sat Aug 28 18:28:34 2010
New Revision: 990403

URL: http://svn.apache.org/viewvc?rev=990403&view=rev
Log:
Fix for XALANC-705.

Modified:
    xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp
    xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp
    xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp
    xalan/c/trunk/src/xalanc/XalanExtensions/FunctionNodeSet.cpp

Modified: xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp?rev=990403&r1=990402&r2=990403&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObjectFactory.hpp Sat Aug 28 18:28:34 2010
@@ -223,6 +223,17 @@ public:
     createUnknown(const XalanDOMString&     theValue) = 0;
 
     /**
+     * Hold a reference to an XObject instance until the
+     * factory is reset. This is needed in a very few cases
+     * when the object lifetime needs to extend after the
+     * execution of an XPath expression.
+     * 
+     * @param theValue  The XObjectPtr instance.
+     */
+    virtual void
+    holdReference(XObjectPtr    theValue) = 0;
+
+    /**
      *
      * A public functor for use with stl algorithms.
      *

Modified: xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp?rev=990403&r1=990402&r2=990403&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.cpp Sat Aug 28 18:28:34 2010
@@ -61,7 +61,8 @@ XObjectFactoryDefault::XObjectFactoryDef
     m_xnodesetCache(theManager),
     m_xstringCache(theManager),
     m_xbooleanFalse(false, theManager),
-    m_xbooleanTrue(true, theManager)
+    m_xbooleanTrue(true, theManager),
+    m_references(theManager)
 {
 }
 
@@ -470,8 +471,18 @@ XObjectFactoryDefault::createString(GetC
 
 
 void
+XObjectFactoryDefault::holdReference(XObjectPtr    theValue)
+{
+    m_references.push_back(theValue);
+}
+
+
+
+void
 XObjectFactoryDefault::reset()
 {
+    m_references.clear();
+
     m_xstringAdapterAllocator.reset();
 
     m_xstringAllocator.reset();

Modified: xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp?rev=990403&r1=990402&r2=990403&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XObjectFactoryDefault.hpp Sat Aug 28 18:28:34 2010
@@ -154,6 +154,9 @@ public:
     virtual const XObjectPtr
     createUnknown(const XalanDOMString&     theValue);
 
+    virtual void
+    holdReference(XObjectPtr    theValue);
+
     typedef XalanVector<XObject*>       XObjectCollectionType;
     typedef XalanVector<XNumber*>       XNumberCacheType;
     typedef XalanVector<XNodeSet*>      XNodeSetCacheType;
@@ -211,6 +214,8 @@ private:
     XBoolean                        m_xbooleanFalse;
 
     XBoolean                        m_xbooleanTrue;
+
+    XalanVector<XObjectPtr>         m_references;
 };
 
 

Modified: xalan/c/trunk/src/xalanc/XalanExtensions/FunctionNodeSet.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanExtensions/FunctionNodeSet.cpp?rev=990403&r1=990402&r2=990403&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanExtensions/FunctionNodeSet.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanExtensions/FunctionNodeSet.cpp Sat Aug 28 18:28:34 2010
@@ -148,10 +148,13 @@ FunctionNodeSet::execute(
     if (theType == XObject::eTypeResultTreeFrag ||
         (theType == XObject::eTypeString && m_convertString == true))
     {
-        return XObjectPtr(
-                    XalanDocumentFragmentXNodeSetBaseProxy::create(
-                        executionContext,
-                        args[0]));
+        const XObjectPtr    theResult(
+                        XalanDocumentFragmentXNodeSetBaseProxy::create(
+                            executionContext,
+                            args[0]));
+        executionContext.getXObjectFactory().holdReference(theResult);
+
+        return theResult;
     }
     else
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message