activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r928920 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/decaf/lang/ArrayPointer.h test/decaf/lang/ArrayPointerTest.cpp
Date Mon, 29 Mar 2010 22:29:56 GMT
Author: tabish
Date: Mon Mar 29 22:29:56 2010
New Revision: 928920

URL: http://svn.apache.org/viewvc?rev=928920&view=rev
Log:
Fix a bug in the release function.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/ArrayPointer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/ArrayPointerTest.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/ArrayPointer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/ArrayPointer.h?rev=928920&r1=928919&r2=928920&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/ArrayPointer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/ArrayPointer.h Mon Mar 29
22:29:56 2010
@@ -181,8 +181,9 @@ namespace lang {
          *          out of scope.
          */
         T* release() {
-            T* temp = this->value;
-            this->array = NULL;
+            T* temp = this->array->value;
+            this->array->value = NULL;
+            this->array->length = 0;
             return temp;
         }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/ArrayPointerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/ArrayPointerTest.cpp?rev=928920&r1=928919&r2=928920&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/ArrayPointerTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/ArrayPointerTest.cpp Mon
Mar 29 22:29:56 2010
@@ -167,6 +167,12 @@ void ArrayPointerTest::testBasics() {
         ArrayPointer<ExceptionThrowingClass> ex( 1 );
         CPPUNIT_FAIL( "Should Have Thrown." );
     } catch(...) {}
+
+    {
+        ArrayPointer<unsigned char> array( 50 );
+        unsigned char* buffer = array.release();
+        delete [] buffer;
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////



Mime
View raw message