From d1a2977fc1b333b6548b58e9a146a5b3dce1f990 Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Thu, 8 Sep 2016 17:25:01 +0200
Subject: [PATCH] Clear roadmap before destroying it

  Data are stored in the constraint graph. Clearing the roadmap also
  clears these data and make problem resolution re-entrant.
---
 src/problem-solver.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/problem-solver.cc b/src/problem-solver.cc
index 80521aa..0da115e 100644
--- a/src/problem-solver.cc
+++ b/src/problem-solver.cc
@@ -312,6 +312,8 @@ namespace hpp {
     {
       if (!problem ())
         throw std::runtime_error ("The problem is not defined.");
+      if (roadmap())
+        roadmap()->clear();
       RoadmapPtr_t r (Roadmap::create (problem ()->distance (), problem ()->robot ()));
       if (constraintGraph_) r->constraintGraph (constraintGraph_);
       roadmap (r);
-- 
GitLab