From 2c00cd71d07bd8c247147152060e37d8542318e6 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 18 Apr 2008 16:40:29 +0000
Subject: [PATCH] - trying to fix race condition in value assigned to
 mesh.changed (nico) - temp fix in Open to delete obsolete views

---
 Common/Options.cpp           | 74 ++++++++++++++++++------------------
 Fltk/Callbacks.cpp           | 12 +++---
 Mesh/BackgroundMesh.cpp      |  8 ++--
 Mesh/meshGFace.cpp           | 26 +++----------
 Parser/OpenFile.cpp          | 11 +++++-
 Post/PViewDataGModel.cpp     |  3 +-
 doc/TODO                     | 16 +++-----
 doc/texinfo/opt_general.texi | 11 ++++--
 utils/embed/GmshEmbedded.cpp |  6 +--
 utils/misc/Info.plist        |  5 ++-
 10 files changed, 83 insertions(+), 89 deletions(-)

diff --git a/Common/Options.cpp b/Common/Options.cpp
index 9191661a05..597b952acb 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.393 2008-04-16 15:15:22 sabarieg Exp $
+// $Id: Options.cpp,v 1.394 2008-04-18 16:40:28 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -4308,7 +4308,7 @@ double opt_mesh_explode(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.explode != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.explode = val;
   }
 #if defined(HAVE_FLTK)
@@ -4405,7 +4405,7 @@ double opt_mesh_quality_type(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.quality_type != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.quality_type = (int)val;
     if(CTX.mesh.quality_type < 0 || CTX.mesh.quality_type > 2)
       CTX.mesh.quality_type = 0;
@@ -4422,7 +4422,7 @@ double opt_mesh_quality_inf(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.quality_inf != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.quality_inf = val;
   }
 #if defined(HAVE_FLTK)
@@ -4436,7 +4436,7 @@ double opt_mesh_quality_sup(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.quality_sup != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.quality_sup = val;
   }
 #if defined(HAVE_FLTK)
@@ -4450,7 +4450,7 @@ double opt_mesh_radius_inf(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.radius_inf != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.radius_inf = val;
   }
 #if defined(HAVE_FLTK)
@@ -4464,7 +4464,7 @@ double opt_mesh_radius_sup(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.radius_sup != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.radius_sup = val;
   }
 #if defined(HAVE_FLTK)
@@ -4505,7 +4505,7 @@ double opt_mesh_lines(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.lines != val) 
-      CTX.mesh.changed = ENT_LINE;
+      CTX.mesh.changed |= ENT_LINE;
     CTX.mesh.lines = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4519,7 +4519,7 @@ double opt_mesh_triangles(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.triangles != val) 
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.mesh.triangles = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4537,7 +4537,7 @@ double opt_mesh_quadrangles(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.quadrangles != val) 
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.mesh.quadrangles = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4555,7 +4555,7 @@ double opt_mesh_tetrahedra(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.tetrahedra != val) 
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.mesh.tetrahedra = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4573,7 +4573,7 @@ double opt_mesh_hexahedra(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.hexahedra != val) 
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.mesh.hexahedra = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4591,7 +4591,7 @@ double opt_mesh_prisms(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.prisms != val) 
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.mesh.prisms = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4609,7 +4609,7 @@ double opt_mesh_pyramids(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.pyramids != val)
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.mesh.pyramids = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4627,7 +4627,7 @@ double opt_mesh_surfaces_edges(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.surfaces_edges != val) 
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.mesh.surfaces_edges = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4641,7 +4641,7 @@ double opt_mesh_surfaces_faces(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.surfaces_faces != val)
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.mesh.surfaces_faces = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4655,7 +4655,7 @@ double opt_mesh_volumes_edges(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.volumes_edges != val)
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.mesh.volumes_edges = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4669,7 +4669,7 @@ double opt_mesh_volumes_faces(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.volumes_faces != val)
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.mesh.volumes_faces = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4780,7 +4780,7 @@ double opt_mesh_reverse_all_normals(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.reverse_all_normals != val)
-      CTX.mesh.changed = ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.reverse_all_normals = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4794,7 +4794,7 @@ double opt_mesh_smooth_normals(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.smooth_normals != val)
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.mesh.smooth_normals = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -4808,7 +4808,7 @@ double opt_mesh_angle_smooth_normals(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
     if(CTX.mesh.angle_smooth_normals != val)
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.mesh.angle_smooth_normals = val;
   }
 #if defined(HAVE_FLTK)
@@ -5057,7 +5057,7 @@ double opt_mesh_use_cut_plane(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(CTX.mesh.use_cut_plane != (int)val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.use_cut_plane = (int)val;
 #if defined(HAVE_FLTK)
     if(WID){
@@ -5084,7 +5084,7 @@ double opt_mesh_cut_plane_draw_intersect(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(CTX.mesh.cut_plane_draw_intersect != (int)val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.cut_plane_draw_intersect = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -5098,7 +5098,7 @@ double opt_mesh_cut_plane_only_volume(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(CTX.mesh.cut_plane_only_volume != (int)val)
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.cut_plane_only_volume = (int)val;
   }
 #if defined(HAVE_FLTK)
@@ -5112,7 +5112,7 @@ double opt_mesh_cut_planea(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(CTX.mesh.cut_planea != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.cut_planea = val;
   }
 #if defined(HAVE_FLTK)
@@ -5126,7 +5126,7 @@ double opt_mesh_cut_planeb(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(CTX.mesh.cut_planeb != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.cut_planeb = val;
   }
 #if defined(HAVE_FLTK)
@@ -5140,7 +5140,7 @@ double opt_mesh_cut_planec(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(CTX.mesh.cut_planec != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.cut_planec = val;
   }
 #if defined(HAVE_FLTK)
@@ -5154,7 +5154,7 @@ double opt_mesh_cut_planed(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(CTX.mesh.cut_planed != val) 
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.cut_planed = val;
   }
 #if defined(HAVE_FLTK)
@@ -5185,7 +5185,7 @@ double opt_mesh_color_carousel(OPT_ARGS_NUM)
     // element type or by partition
     if(CTX.mesh.color_carousel != (int)val && 
        ((val == 0. || val == 3.) || CTX.pick_elements))
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.mesh.color_carousel = (int)val;
     if(CTX.mesh.color_carousel < 0 || CTX.mesh.color_carousel > 3)
       CTX.mesh.color_carousel = 0;
@@ -7469,7 +7469,7 @@ unsigned int opt_mesh_color_lines(OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // element type
     if(CTX.color.mesh.line != val && CTX.mesh.color_carousel == 0)
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.color.mesh.line = val;
   }
 #if defined(HAVE_FLTK)
@@ -7484,7 +7484,7 @@ unsigned int opt_mesh_color_triangles(OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // element type
     if(CTX.color.mesh.triangle != val && CTX.mesh.color_carousel == 0)
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.color.mesh.triangle = val;
   }
 #if defined(HAVE_FLTK)
@@ -7499,7 +7499,7 @@ unsigned int opt_mesh_color_quadrangles(OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // element type
     if(CTX.color.mesh.quadrangle != val && CTX.mesh.color_carousel == 0)
-      CTX.mesh.changed = ENT_SURFACE;
+      CTX.mesh.changed |= ENT_SURFACE;
     CTX.color.mesh.quadrangle = val;
   }
 #if defined(HAVE_FLTK)
@@ -7514,7 +7514,7 @@ unsigned int opt_mesh_color_tetrahedra(OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // element type
     if(CTX.color.mesh.tetrahedron != val && CTX.mesh.color_carousel == 0)
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.color.mesh.tetrahedron = val;
   }
 #if defined(HAVE_FLTK)
@@ -7529,7 +7529,7 @@ unsigned int opt_mesh_color_hexahedra(OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // element type
     if(CTX.color.mesh.hexahedron != val && CTX.mesh.color_carousel == 0)
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.color.mesh.hexahedron = val;
   }
 #if defined(HAVE_FLTK)
@@ -7544,7 +7544,7 @@ unsigned int opt_mesh_color_prisms(OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // element type
     if(CTX.color.mesh.prism != val && CTX.mesh.color_carousel == 0)
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.color.mesh.prism = val;
   }
 #if defined(HAVE_FLTK)
@@ -7559,7 +7559,7 @@ unsigned int opt_mesh_color_pyramid(OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // element type
     if(CTX.color.mesh.pyramid != val && CTX.mesh.color_carousel == 0)
-      CTX.mesh.changed = ENT_VOLUME;
+      CTX.mesh.changed |= ENT_VOLUME;
     CTX.color.mesh.pyramid = val;
   }
 #if defined(HAVE_FLTK)
@@ -7596,7 +7596,7 @@ unsigned int opt_mesh_color_(int i, OPT_ARGS_COL)
     // vertex arrays need to be regenerated only when we color by
     // partition
     if(CTX.color.mesh.carousel[i] != val && CTX.mesh.color_carousel == 3)
-      CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+      CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     CTX.color.mesh.carousel[i] = val;
   }
 #if defined(HAVE_FLTK)
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 1fcf4d6b37..11c907cff2 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.579 2008-04-16 18:12:39 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.580 2008-04-18 16:40:28 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -1986,7 +1986,7 @@ void visibility_ok_cb(CALLBACK_ARGS)
   // if the browser is not empty, get the selections made in the
   // browser and apply them into the model
   if(VisibilityManager::instance()->getNumEntities()){
-    CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+    CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
     bool recursive = WID->vis_butt[0]->value() ? true : false;
     int type = WID->vis_type->value();
     VisibilityManager::instance()->setAllInvisible(type);
@@ -2093,7 +2093,7 @@ void visibility_sort_cb(CALLBACK_ARGS)
 
 void visibility_number_cb(CALLBACK_ARGS)
 {
-  CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+  CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
 
   // type = 0 for elementary, 1 for physical and 2 for partitions
   int type = WID->vis_type->value();
@@ -3897,7 +3897,7 @@ void mesh_degree_cb(CALLBACK_ARGS)
               CTX.mesh.second_order_incomplete);
   else
     SetOrder1(GModel::current());
-  CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+  CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
   Draw();
   Msg(STATUS2N, " ");
 }
@@ -3911,7 +3911,7 @@ void mesh_optimize_cb(CALLBACK_ARGS)
   CTX.threads_lock = 1;
   OptimizeMesh(GModel::current());
   CTX.threads_lock = 0;
-  CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+  CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
   Draw();
   Msg(STATUS2N, " ");
 }
@@ -3925,7 +3925,7 @@ void mesh_optimize_netgen_cb(CALLBACK_ARGS)
   CTX.threads_lock = 1;
   OptimizeMeshNetgen(GModel::current());
   CTX.threads_lock = 0;
-  CTX.mesh.changed = ENT_LINE | ENT_SURFACE | ENT_VOLUME;
+  CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
   Draw();
   Msg(STATUS2N, " ");
 }
diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp
index e42003df81..1a5403fe7d 100644
--- a/Mesh/BackgroundMesh.cpp
+++ b/Mesh/BackgroundMesh.cpp
@@ -1,4 +1,4 @@
-// $Id: BackgroundMesh.cpp,v 1.51 2008-04-01 16:08:06 geuzaine Exp $
+// $Id: BackgroundMesh.cpp,v 1.52 2008-04-18 16:40:29 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -166,9 +166,9 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double
 
   // lc from fields
   double l4 = MAX_LC;
-  FieldManager &fields = *GModel::current()->getFields();
-  if(fields.background_field > 0){
-    Field *f = fields.get(fields.background_field);
+  FieldManager *fields = GModel::current()->getFields();
+  if(fields->background_field > 0){
+    Field *f = fields->get(fields->background_field);
     if(f) l4 = (*f)(X, Y, Z);
   }
 
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index 9051b4d6d0..c4837450ff 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFace.cpp,v 1.131 2008-04-17 09:07:01 remacle Exp $
+// $Id: meshGFace.cpp,v 1.132 2008-04-18 16:40:29 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -1310,28 +1310,12 @@ void meshGFace::operator() (GFace *gf)
   if(MeshExtrudedSurface(gf)) return;
 
   const char *algo = "Unknown";
-  switch(CTX.mesh.algo2d){
-  case ALGO_2D_MESHADAPT:
+  if(AlgoDelaunay2D(gf))
+    algo = (CTX.mesh.algo2d == ALGO_2D_FRONTAL) ? "Frontal" : "Delaunay";
+  else if(CTX.mesh.algo2d == ALGO_2D_MESHADAPT)
     algo = "MeshAdapt";
-    break;
-  case ALGO_2D_DELAUNAY:
-    // FIXME: Delaunay not available in all cases at the moment
-    if(AlgoDelaunay2D(gf))
-      algo = "Delaunay";
-    else
-      algo = "MeshAdapt+Delaunay";
-    break;
-  case ALGO_2D_FRONTAL:
-    // FIXME: Delaunay not available in all cases at the moment
-    if(AlgoDelaunay2D(gf))
-      algo = "Frontal";
-    else
-      algo = "MeshAdapt+Delaunay";
-    break;
-  case ALGO_2D_MESHADAPT_DELAUNAY:
+  else 
     algo = "MeshAdapt+Delaunay";
-    break;
-  }
 
   Msg(STATUS2, "Meshing surface %d (%s, %s)", 
       gf->tag(), gf->getTypeString().c_str(), algo);
diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
index c42615c1dc..086572c452 100644
--- a/Parser/OpenFile.cpp
+++ b/Parser/OpenFile.cpp
@@ -1,4 +1,4 @@
-// $Id: OpenFile.cpp,v 1.184 2008-04-16 22:10:53 geuzaine Exp $
+// $Id: OpenFile.cpp,v 1.185 2008-04-18 16:40:29 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -436,6 +436,10 @@ void OpenProject(const char *name)
   }
   CTX.threads_lock = 1;
 
+  // FIXME: this will change once we clarify Open/Merge/Clear
+  for(int i = PView::list.size() - 1; i >= 0; i--)
+    if(PView::list[i]->getData()->hasModel(GModel::current()))
+      delete PView::list[i];
   GModel::current()->destroy();
   GModel::current()->getGEOInternals()->destroy();
 
@@ -449,7 +453,10 @@ void OpenProject(const char *name)
   CTX.threads_lock = 0;
 
 #if defined(HAVE_FLTK)
-  if(!CTX.batch) WID->reset_visibility();
+  if(!CTX.batch){
+    WID->reset_visibility();
+    WID->update_views();
+  }
   ZeroHighlight();
 #endif
 }
diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp
index d06a10f202..13127cc271 100644
--- a/Post/PViewDataGModel.cpp
+++ b/Post/PViewDataGModel.cpp
@@ -1,4 +1,4 @@
-// $Id: PViewDataGModel.cpp,v 1.51 2008-04-17 05:58:09 geuzaine Exp $
+// $Id: PViewDataGModel.cpp,v 1.52 2008-04-18 16:40:29 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -380,6 +380,7 @@ void PViewDataGModel::smooth()
 
 bool PViewDataGModel::skipEntity(int step, int ent)
 {
+  if(step >= getNumTimeSteps()) return true;
   return !_steps[step]->getEntity(ent)->getVisibility();
 }
 
diff --git a/doc/TODO b/doc/TODO
index 39bca7d328..31efa1c582 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.69 2008-03-01 10:52:05 geuzaine Exp $
+$Id: TODO,v 1.70 2008-04-18 16:40:29 geuzaine Exp $
 
 ********************************************************************
 
@@ -31,21 +31,12 @@ GModel->checkMeshCoherence
 
 ********************************************************************
 
-add function to deform the MESH with a displacement post-pro view
-
-********************************************************************
-
 3D Delaunay: precompute non-connected volumes and apply algo to each
 non-connected aggregate. This will improve mesh quality and speed for
 close non-connected objects.
 
 ********************************************************************
 
-right-clicking of the X/Y/Z fields in the bottom of the OpenGL could
-have the same effect as shift-clicking.
-
-********************************************************************
-
 interface duplicate entity removal from opencascade
 
 ********************************************************************
@@ -142,6 +133,11 @@ surface.)
 
 ********************************************************************
 
+add "sprite" option to draw fake 3D spheres in post-pro (so that we
+can draw millions of spheres)
+
+********************************************************************
+
 add a min_recursion option for adaptive views (to force at least a 
 certain number of subdivisions)
 
diff --git a/doc/texinfo/opt_general.texi b/doc/texinfo/opt_general.texi
index 25300aeee5..620a4ad2c5 100644
--- a/doc/texinfo/opt_general.texi
+++ b/doc/texinfo/opt_general.texi
@@ -626,17 +626,17 @@ Saved in: @code{General.SessionFileName}
 
 @item General.MessagePositionY
 Vertical position (in pixels) of the upper left corner of the message window@*
-Default value: @code{150}@*
+Default value: @code{490}@*
 Saved in: @code{General.SessionFileName}
 
 @item General.MessageHeight
 Height (in pixels) of the message window@*
-Default value: @code{350}@*
+Default value: @code{180}@*
 Saved in: @code{General.SessionFileName}
 
 @item General.MessageWidth
 Width (in pixels) of the message window@*
-Default value: @code{450}@*
+Default value: @code{100}@*
 Saved in: @code{General.SessionFileName}
 
 @item General.MinX
@@ -664,6 +664,11 @@ Enable mouse selection@*
 Default value: @code{1}@*
 Saved in: @code{General.OptionsFileName}
 
+@item General.NonModalWindows
+Force all control windows to be on top of the graphic window ("non-modal")@*
+Default value: @code{1}@*
+Saved in: @code{General.SessionFileName}
+
 @item General.NoPopup
 Disable interactive dialog windows in scripts (and use default values instead)@*
 Default value: @code{0}@*
diff --git a/utils/embed/GmshEmbedded.cpp b/utils/embed/GmshEmbedded.cpp
index f13ecf4d16..fa3cfa03ec 100644
--- a/utils/embed/GmshEmbedded.cpp
+++ b/utils/embed/GmshEmbedded.cpp
@@ -3,9 +3,9 @@
 
 Context_T CTX;
 
-void GModel::createGEOInternals(){}
-void GModel::deleteGEOInternals(){}
-void GModel::deleteOCCInternals(){}
+void GModel::_createGEOInternals(){}
+void GModel::_deleteGEOInternals(){}
+void GModel::_deleteOCCInternals(){}
 
 void GmshInitialize(int argc, char **argv)
 {
diff --git a/utils/misc/Info.plist b/utils/misc/Info.plist
index 98ce27d74f..a038c28bbb 100644
--- a/utils/misc/Info.plist
+++ b/utils/misc/Info.plist
@@ -30,7 +30,8 @@
           <string>unv</string>
           <string>vrml</string><string>wrl</string><string>iv</string>
           <string>bdf</string><string>nas</string>
-          <string>mesh</string></array>
+          <string>mesh</string>
+          <string>mmed</string></array>
         <key>CFBundleTypeIconFile</key><string>GmshMsh.icns</string>
         <key>CFBundleTypeName</key><string>Gmsh Mesh File</string>
         <key>CFBundleTypeOSTypes</key><array><string>GMSH</string></array>
@@ -39,7 +40,7 @@
       <dict>
         <key>CFBundleTypeExtensions</key><array>
           <string>pos</string>
-          <string>med</string></array>
+          <string>med</string><string>rmed</string></array>
         <key>CFBundleTypeIconFile</key><string>GmshPos.icns</string>
         <key>CFBundleTypeName</key><string>Gmsh Post-Processing File</string>
         <key>CFBundleTypeOSTypes</key><array><string>GPOS</string></array>
-- 
GitLab