Date: Friday, December 1, 2006 @ 22:26:23
  Author: marc
    Path: /cvsroot/carob/carob/include

Modified: CarobException.hpp (1.48 -> 1.49)

Fixed a huge bug in exception chaining: was chaining using a pointer to the 
local exception
(valid only in catch block). Now cloning.


--------------------+
 CarobException.hpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: carob/include/CarobException.hpp
diff -u carob/include/CarobException.hpp:1.48 
carob/include/CarobException.hpp:1.49
--- carob/include/CarobException.hpp:1.48       Thu Jul 27 17:10:53 2006
+++ carob/include/CarobException.hpp    Fri Dec  1 22:26:23 2006
@@ -54,7 +54,7 @@
 {
 public:
   /**
-   * Copy constructor
+   * Copy constructor. Copying, NOT chaining!
    */
   CarobException(const CarobException& ce);
   /**
@@ -81,7 +81,8 @@
                  CarobException* causePrm = 0,
                  int vendorPrm = DEFAULTVENDORCODE) :
     message(messagePrm),
-    causePtr(causePrm),
+     // deep copy constructor (and... slicing)
+    causePtr(causePrm == 0 ? 0 : new CarobException(*causePrm)),
     SQLState(SQLStatePrm),
     errorCode(vendorPrm)
   { }
@@ -112,6 +113,7 @@
   std::wstring                message;
   /** Stack trace as a vector of traces */
   StackTrace                  stackTrace;
+  // TODO: try to use a real field + a special "end of chain" exception.
   /** pointer to the exception that generated this one */
   CarobException*             causePtr;
 

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to