From c58cc3ca6baabe488923cb4c8aa7e17eb855576b Mon Sep 17 00:00:00 2001
From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be>
Date: Tue, 25 Nov 2008 16:27:16 +0000
Subject: [PATCH] *** empty log message ***

---
 Geo/Geo.cpp       |  2 +-
 Geo/gmshSurface.h | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index 5832b233e4..54676badbe 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -126,6 +126,7 @@ Vertex *Create_Vertex(int Num, double u, double v, gmshSurface *surf, double lc)
   pV->u = u;
   pV->geometry = surf;
   pV->pntOnGeometry = SPoint2(u,v);
+  surf->is_projection_surface=true;
   return pV;
 }
 
@@ -3069,7 +3070,6 @@ bool SplitCurve(int line_id, List_T *vertices_id, List_T *shapes)
   DeleteShape(c->Typ, c->Num);
   List_Delete(new_list);
   List_Delete(rshapes);
-
   return true;
 }
 
diff --git a/Geo/gmshSurface.h b/Geo/gmshSurface.h
index 6f61d0a949..34ac7c013e 100644
--- a/Geo/gmshSurface.h
+++ b/Geo/gmshSurface.h
@@ -21,12 +21,15 @@ class gmshSurface
 protected:  
   static std::map<int, gmshSurface*> allGmshSurfaces;
 public:
+  bool is_projection_surface;
   virtual ~gmshSurface(){}
   static void reset() 
   {
     std::map<int, gmshSurface*>::iterator it = allGmshSurfaces.begin();
-    for (; it != allGmshSurfaces.end(); ++it)
-      delete it->second;
+    for (; it != allGmshSurfaces.end(); ++it){
+      if(!it->second->is_projection_surface)
+        delete it->second;
+    }
     allGmshSurfaces.clear();
   };
   static gmshSurface* getSurface(int tag);
@@ -78,11 +81,13 @@ public:
   }
 };
 
+#include "stdio.h"
 class gmshPolarSphere : public gmshSurface
 {
   double r;
   SPoint3 o;
-  gmshPolarSphere(double x, double y, double z, double _r) : r(_r), o(x,y,z) {}
+  gmshPolarSphere(double x, double y, double z, double _r) : r(_r), o(x,y,z) {
+  }
 public:
   static gmshSurface *NewPolarSphere(int _iSphere, double _x, double _y, double _z, double _r);
   virtual Range<double> parBounds(int i) const 
-- 
GitLab