Fixed bug 114764
authorWilliam M. Brack <wbrack@src.gnome.org>
Sat, 12 Jul 2003 12:35:37 +0000 (12:35 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Sat, 12 Jul 2003 12:35:37 +0000 (12:35 +0000)
ChangeLog
libxslt/transform.c
libxslt/variables.c

index 6b45ef8..6c3b608 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Jul 12 20:35:28 HKT 2003 William Brack <wbrack@mmm.com.hk>
+
+       * fixed bug 114764, trouble with globals and RVT's
+         with minor changes in variables.c and transform.c
+         so that any global instantiated with an RVT gets
+         uninitialized when the RVT is destroyed.
+         
 Thu Jul 10 15:47:33 CEST 2003 Daniel Veillard <daniel@veillard.com>
 
        * libxslt/transform.c: simple cast missing Peter Breitenlohner
index 713c4bb..ae800a4 100644 (file)
@@ -1688,11 +1688,18 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
         templPop(ctxt);
        /*
         * Free up all the unreferenced RVT
+        * Also set any global variables instantiated
+        * using them, to be "not yet computed".
         */
        if (ctxt->tmpRVT != NULL) {
+           xsltStackElemPtr elem;
            xmlDocPtr tmp = ctxt->tmpRVT, next;
-
             while (tmp != NULL) {
+               elem = (xsltStackElemPtr)tmp->_private;
+               if (elem != NULL) {
+                   elem->computed = 0;
+                   xmlXPathFreeObject(elem->value);
+               }
                next = (xmlDocPtr) tmp->next;
                xmlFreeDoc(tmp);
                tmp = next;
@@ -2328,7 +2335,7 @@ xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node,
                xsltGenericDebug(xsltGenericDebugContext,
                                 "xsltCopy: namespace declaration\n");
 #endif
-                xsltCopyNamespace(ctxt, ctxt->insert, (xmlNsPtr) node);
+                xsltCopyNamespace(ctxt, ctxt->insert, (xmlNsPtr)node);
                break;
            default:
                break;
index 76e9158..6186082 100644 (file)
@@ -39,7 +39,6 @@
  *                     Result Value Tree interfaces                    *
  *                                                                     *
  ************************************************************************/
-
 /**
  * xsltCreateRVT:
  * @ctxt:  an XSLT transformation context
@@ -471,7 +470,6 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr elem,
             * Tag the subtree for removal once consumed
             */
            xsltRegisterTmpRVT(ctxt, container);
-
            oldoutput = ctxt->output;
            ctxt->output = container;
            oldInsert = ctxt->insert;
@@ -606,7 +604,10 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) {
             * Tag the subtree for removal once consumed
             */
            xsltRegisterTmpRVT(ctxt, container);
-
+           /*
+            * Save a pointer to the global variable for later cleanup
+            */
+           container->_private = elem;
            oldoutput = ctxt->output;
            ctxt->output = container;
            oldInsert = ctxt->insert;