From c8f53f9b42e1d7cfed97c2f737d9172429bdb506 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Wed, 26 Sep 2018 19:53:42 +0200
Subject: [PATCH] Fix DynamicPinocchio destructor

---
 src/sot-dynamic-pinocchio.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/sot-dynamic-pinocchio.cpp b/src/sot-dynamic-pinocchio.cpp
index 1d5430a..4f17bf5 100644
--- a/src/sot-dynamic-pinocchio.cpp
+++ b/src/sot-dynamic-pinocchio.cpp
@@ -233,11 +233,12 @@ DynamicPinocchio( const std::string & name)
 
 DynamicPinocchio::~DynamicPinocchio( void ) {
   sotDEBUGIN(15);
-    //  if (0!=m_model){ delete m_model; m_model=NULL;}
-  if (0!=m_data)
-    { delete m_data; m_data=NULL; }
-  if (0!=m_model)
-    { delete m_model; m_model=NULL; }
+  // TODO currently, m_model and m_data are pointers owned by the Python interpreter
+  // so we should not delete them.
+  // I (Joseph Mirabel) think it would be wiser to make them belong to this class but
+  // I do not know the impact it has.
+  //if (0!=m_data ) { delete m_data ; m_data =NULL; }
+  //if (0!=m_model) { delete m_model; m_model=NULL; }
 
   for( std::list< SignalBase<int>* >::iterator iter = genericSignalRefs.begin();
        iter != genericSignalRefs.end();
-- 
GitLab