Index: /trunk/ReleaseNotes
===================================================================
--- /trunk/ReleaseNotes	(revision 147)
+++ /trunk/ReleaseNotes	(revision 148)
@@ -1,4 +1,5 @@
 * Actual Version:
 
+- resolved https://devel.hds.utc.fr/software/flair/ticket/17
 - resolved https://devel.hds.utc.fr/software/flair/ticket/16
 - added lib/FlairCore/src/Semaphore.cpp
Index: /trunk/demos/Sinus/src/MeanFilter.cpp
===================================================================
--- /trunk/demos/Sinus/src/MeanFilter.cpp	(revision 147)
+++ /trunk/demos/Sinus/src/MeanFilter.cpp	(revision 148)
@@ -43,4 +43,5 @@
                        "mean filter"); // name will be used for graphs and logs
   output = new cvmatrix(this, desc, floatType, name);
+  delete desc;
 
   AddDataToLog(output);
Index: /trunk/demos/Sinus/src/Sinus.cpp
===================================================================
--- /trunk/demos/Sinus/src/Sinus.cpp	(revision 147)
+++ /trunk/demos/Sinus/src/Sinus.cpp	(revision 148)
@@ -42,5 +42,5 @@
   desc->SetElementName(0, 0, "value"); // name will be used for graphs and logs
   output = new cvmatrix((IODevice *)this, desc, floatType, name);
-  output->SetValue(0, 0, 0);
+  delete desc;
 
   AddDataToLog(output);
Index: /trunk/lib/FlairCore/src/cvmatrix.h
===================================================================
--- /trunk/lib/FlairCore/src/cvmatrix.h	(revision 147)
+++ /trunk/lib/FlairCore/src/cvmatrix.h	(revision 148)
@@ -59,5 +59,5 @@
   *
   * \param parent parent
-  * \param descriptor matrix description
+  * \param descriptor matrix description, it is safe to destroy it after calling this constructor
   * \param type type of matrix elements
   * \param name name
Index: /trunk/lib/FlairCore/src/cvmatrix_impl.cpp
===================================================================
--- /trunk/lib/FlairCore/src/cvmatrix_impl.cpp	(revision 147)
+++ /trunk/lib/FlairCore/src/cvmatrix_impl.cpp	(revision 148)
@@ -33,9 +33,15 @@
 
 cvmatrix_impl::cvmatrix_impl(cvmatrix *self,
-                             const cvmatrix_descriptor *descriptor,
+                             const cvmatrix_descriptor *inDescriptor,
                              flair::core::ScalarType const &_elementDataType,
                              int n)
     : elementDataType(_elementDataType) {
-  this->descriptor = descriptor;
+  descriptor = new cvmatrix_descriptor(inDescriptor->Rows(), inDescriptor->Cols());
+
+  for (uint32_t i = 0; i < descriptor->Rows(); i++) {
+    for (uint32_t j = 0; j < descriptor->Cols(); j++) {
+      descriptor->SetElementName(i, j, inDescriptor->ElementName(i, j));
+    }
+  }
   Init(self, n);
 }
Index: /trunk/lib/FlairCore/src/unexported/cvmatrix_impl.h
===================================================================
--- /trunk/lib/FlairCore/src/unexported/cvmatrix_impl.h	(revision 147)
+++ /trunk/lib/FlairCore/src/unexported/cvmatrix_impl.h	(revision 148)
@@ -34,7 +34,5 @@
   CvMat *mat;
   flair::core::ScalarType const &elementDataType;
-  // const since if element description is modified it would be a mess in the
-  // log
-  const flair::core::cvmatrix_descriptor *descriptor;
+  flair::core::cvmatrix_descriptor *descriptor;
 
 private:
Index: /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/ButterworthLowPass_impl.cpp	(revision 148)
@@ -42,6 +42,5 @@
   desc->SetElementName(0, 0, "output");
   output = new cvmatrix(self, desc, floatType, name);
-
-  output->SetValue(0, 0, 0);
+  delete desc;
 
   f = new PoleFilter(order);
Index: /trunk/lib/FlairFilter/src/ControlLaw.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/ControlLaw.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/ControlLaw.cpp	(revision 148)
@@ -41,4 +41,5 @@
     }
     output = new cvmatrix(this, desc, floatType, name);
+    delete desc;
   }
 
Index: /trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/EulerDerivative_impl.cpp	(revision 148)
@@ -44,4 +44,5 @@
     }
     output = new cvmatrix(self, desc,init_value->GetDataType().GetElementDataType(), name);
+    delete desc;
     for (int i = 0; i < init_value->Rows(); i++) {
       for (int j = 0; j < init_value->Cols(); j++) {
@@ -54,5 +55,5 @@
     desc->SetElementName(0, 0, "output");
     output = new cvmatrix(self, desc, floatType, name);
-    output->SetValue(0, 0, 0);
+    delete desc;
   }
   
Index: /trunk/lib/FlairFilter/src/JoyReference_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/JoyReference_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/JoyReference_impl.cpp	(revision 148)
@@ -49,4 +49,5 @@
   desc->SetElementName(3, 0, "trim_pitch");
   output = new cvmatrix(self, desc, floatType, name);
+  delete desc;
 
   reglages_groupbox = new GroupBox(position, name);
Index: /trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/LowPassFilter_impl.cpp	(revision 148)
@@ -51,4 +51,5 @@
       }
     }
+    delete desc;
   } else {
     // if NULL, assume dimension 1, and init=0
@@ -56,5 +57,5 @@
     desc->SetElementName(0, 0, "output");
     output = new cvmatrix(self, desc, floatType, name);
-    output->SetValue(0, 0, 0);
+    delete desc;
   }
 
Index: /trunk/lib/FlairFilter/src/PidThrust_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/PidThrust_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/PidThrust_impl.cpp	(revision 148)
@@ -45,4 +45,5 @@
   desc->SetElementName(4, 0, "p+i+d+offset");
   state = new cvmatrix(self, desc, floatType, name);
+  delete desc;
 
   GroupBox *reglages_groupbox = new GroupBox(position, name);
Index: /trunk/lib/FlairFilter/src/Pid_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/Pid_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/Pid_impl.cpp	(revision 148)
@@ -42,4 +42,5 @@
   desc->SetElementName(3, 0, "p+i+d");
   state = new cvmatrix(self, desc, floatType, name);
+  delete desc;
 
   GroupBox *reglages_groupbox = new GroupBox(position, name);
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator1D_impl.cpp	(revision 148)
@@ -64,4 +64,5 @@
   desc->SetElementName(1, 0, "vel");
   output = new cvmatrix(self, desc, floatType, name);
+  delete desc;
 
   output->SetValue(0, 0, pos);
Index: /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/TrajectoryGenerator2DCircle_impl.cpp	(revision 148)
@@ -57,9 +57,5 @@
   desc->SetElementName(1, 1, "vel.y");
   output = new cvmatrix(self, desc, floatType, name);
-
-  output->SetValue(0, 0, 0);
-  output->SetValue(0, 1, 0);
-  output->SetValue(1, 0, 0);
-  output->SetValue(1, 1, 0);
+  delete desc;
 }
 
Index: /trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp	(revision 147)
+++ /trunk/lib/FlairFilter/src/X4X8Multiplex_impl.cpp	(revision 148)
@@ -56,5 +56,5 @@
 
   output = new cvmatrix(self, desc, floatType);
-
+  delete desc;
   self->AddDataToLog(output);
 }
Index: /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 147)
+++ /trunk/lib/FlairMeta/src/MetaVrpnObject.cpp	(revision 148)
@@ -56,7 +56,5 @@
   }
   cvmatrix *prev_value = new cvmatrix(this, desc, elementDataType, name);
-  for (int i = 0; i < prev_value->Rows(); i++) {
-    prev_value->SetValue(i, 0, 0);
-  }
+  delete desc;
 
   pbas = new LowPassFilter(this, GetVrpnClient()->GetLayout()->NewRow(),
@@ -69,7 +67,5 @@
   }
   prev_value = new cvmatrix(this, desc, elementDataType, name);
-  for (int i = 0; i < prev_value->Rows(); i++) {
-    prev_value->SetValue(i, 0, 0);
-  }
+  delete desc;
 
   euler = new EulerDerivative(pbas, GetVrpnClient()->GetLayout()->NewRow(),
Index: /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp	(revision 147)
+++ /trunk/lib/FlairSensorActuator/src/BlCtrlV2_x4_speed.cpp	(revision 148)
@@ -132,5 +132,6 @@
   desc->SetElementName(3, 1, "cons arriere gauche");
   output = new cvmatrix((IODevice *)this, desc, floatType);
-
+  delete desc;
+  
   /*
 
Index: /trunk/lib/FlairSensorActuator/src/Bldc.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 147)
+++ /trunk/lib/FlairSensorActuator/src/Bldc.cpp	(revision 148)
@@ -54,4 +54,5 @@
 
   output = new cvmatrix(this, desc, floatType);
+  delete desc;
   AddDataToLog(output);
 }
Index: /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp	(revision 147)
+++ /trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.cpp	(revision 148)
@@ -41,4 +41,5 @@
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(1081, 1);
   output = new cvmatrix((IODevice *)this, desc, SignedIntegerType(16));
+  delete desc;
 
   bufRetMut =
Index: /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp	(revision 147)
+++ /trunk/lib/FlairSensorActuator/src/LaserRangeFinder.cpp	(revision 148)
@@ -39,6 +39,7 @@
   cvmatrix_descriptor *desc = new cvmatrix_descriptor(360, 1);
   output = new cvmatrix(this, desc, floatType);
+  delete desc;
   AddDataToLog(output);
-
+Warn("output matrix is created in LaserRangeFinder and utm30lx\n");
   // station sol
   main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
Index: /trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp	(revision 147)
+++ /trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp	(revision 148)
@@ -45,4 +45,5 @@
   }
   output = new cvmatrix(this, desc, floatType, name);
+  delete desc;
 
   // station sol
Index: /trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp	(revision 147)
+++ /trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp	(revision 148)
@@ -39,4 +39,5 @@
   desc->SetElementName(0, 0, name);
   output = new cvmatrix(this, desc, floatType);
+  delete desc;
   AddDataToLog(output);
 
Index: /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 147)
+++ /trunk/lib/FlairSensorActuator/src/VrpnObject_impl.cpp	(revision 148)
@@ -66,4 +66,5 @@
   desc->SetElementName(6, 0, "z");
   output = new cvmatrix(self, desc, floatType);
+  delete desc;
 
   desc = new cvmatrix_descriptor(3, 1);
@@ -72,4 +73,5 @@
   desc->SetElementName(2, 0, "yaw");
   state = new cvmatrix(self, desc, floatType);
+  delete desc;
 
   // ui
Index: /trunk/lib/FlairSimulator/src/Model_impl.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 147)
+++ /trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 148)
@@ -128,4 +128,5 @@
   desc->SetElementName(12, 0, "vz");
   output = new cvmatrix(this, desc, floatType, "state");
+  delete desc;
 
   self->AddDataToLog(output);
Index: /trunk/lib/FlairVisionFilter/src/HoughLines.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 147)
+++ /trunk/lib/FlairVisionFilter/src/HoughLines.cpp	(revision 148)
@@ -50,4 +50,5 @@
     desc->SetElementName(3,0,"line_detected");
     output=new cvmatrix(this,desc,floatType,name);
+    delete desc;
 
     try{
Index: /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp
===================================================================
--- /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp	(revision 147)
+++ /trunk/lib/FlairVisionFilter/src/OpticalFlowSpeed.cpp	(revision 148)
@@ -27,8 +27,9 @@
 OpticalFlowSpeed::OpticalFlowSpeed(const IODevice* parent,string name) : IODevice(parent,name)
 {
-    cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,1);
-    desc->SetElementName(0,0,"vx");
-	desc->SetElementName(1,0,"vy");
-    output=new cvmatrix(this,desc,floatType,name);
+  cvmatrix_descriptor* desc=new cvmatrix_descriptor(2,1);
+  desc->SetElementName(0,0,"vx");
+  desc->SetElementName(1,0,"vy");
+  output=new cvmatrix(this,desc,floatType,name);
+  delete desc;
 
 	AddDataToLog(output);
Index: /trunk/tools/Controller/DualShock3/src/DualShock3.cpp
===================================================================
--- /trunk/tools/Controller/DualShock3/src/DualShock3.cpp	(revision 147)
+++ /trunk/tools/Controller/DualShock3/src/DualShock3.cpp	(revision 148)
@@ -97,4 +97,5 @@
   }
   axis = new cvmatrix((IODevice *)this, axisDescriptor, Int16Type);
+  delete axisDescriptor;
   AddDataToLog(axis);
 
