Chris Hillery has proposed merging lp:~zorba-coders/zorba/fix-invoke-context 
into lp:zorba.

Requested reviews:
  Chris Hillery (ceejatec)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix-invoke-context/+merge/106081
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-invoke-context/+merge/106081
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/api/invoke_item_sequence.cpp'
--- src/api/invoke_item_sequence.cpp	2012-05-03 12:31:51 +0000
+++ src/api/invoke_item_sequence.cpp	2012-05-17 00:31:19 +0000
@@ -18,12 +18,17 @@
 #include <zorba/iterator.h>
 #include "api/invoke_item_sequence.h"
 #include "api/xqueryimpl.h"
+#include "api/staticcontextimpl.h"
 
 namespace zorba { 
 
-InvokeItemSequence::InvokeItemSequence(XQueryImpl* aQuery, Iterator_t aIter)
+InvokeItemSequence::InvokeItemSequence(
+    XQueryImpl* aQuery,
+    Iterator_t aIter,
+    StaticContext* aSctx)
   : theIterator(aIter),
-    theXQuery(aQuery)
+    theXQuery(aQuery),
+    theSctx(aSctx)
 {
 }
 

=== modified file 'src/api/invoke_item_sequence.h'
--- src/api/invoke_item_sequence.h	2012-05-03 12:31:51 +0000
+++ src/api/invoke_item_sequence.h	2012-05-17 00:31:19 +0000
@@ -34,7 +34,10 @@
       /**
        * Construct a sequence using an Iterator and its XQuery
        */
-      InvokeItemSequence(XQueryImpl* aQuery, Iterator_t aIter);
+      InvokeItemSequence(
+          XQueryImpl* aQuery,
+          Iterator_t aIter,
+          StaticContext* aSctx);
 
       /** \brief Destructor
        */
@@ -48,6 +51,8 @@
     protected:
       Iterator_t theIterator;
       XQueryImpl* theXQuery; // have ownership and destroy in destructor
+      // used to make sure the ctx lives longer then this sequence
+      StaticContext_t theSctx;
 
   }; /* class InvokeItemSequence */
 

=== modified file 'src/api/staticcontextimpl.cpp'
--- src/api/staticcontextimpl.cpp	2012-05-15 21:12:27 +0000
+++ src/api/staticcontextimpl.cpp	2012-05-17 00:31:19 +0000
@@ -1482,9 +1482,10 @@
 
     // the XQueryImpl object needs to live as long as its iterator
     // because the iterator returned as a result of the query
-    // contains a reference to the query in order to do cleanup work
+    // contains a reference to the query in order to do cleanup work.
+    // The same is true for this sctx
     Iterator_t lIter = impl->iterator();
-    return new InvokeItemSequence(impl.release(), lIter);
+    return new InvokeItemSequence(impl.release(), lIter, const_cast<StaticContextImpl*>(this));
   } 
   catch (ZorbaException const& e)
   {

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to