Skip to content
Snippets Groups Projects
Commit c68848a7 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

reinitialize the parser symbol tree when we open a new projet file

(only if the current model is not empty: if it's empty it probably mean
we just launched gmsh, and we don't want to delete variables set e.g.
using the -string command line option)

all this open/merge stuff needs to be cleaned up
parent 13f04dba
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ int GmshInitialize(int argc, char **argv) ...@@ -32,7 +32,7 @@ int GmshInitialize(int argc, char **argv)
// Initialize messages (parallel stuff, etc.) // Initialize messages (parallel stuff, etc.)
Msg::Init(argc, argv); Msg::Init(argc, argv);
#if !defined(HAVE_NO_POST) #if !defined(HAVE_NO_PARSER)
// Initialize the symbol tree that will hold variable names in the // Initialize the symbol tree that will hold variable names in the
// parser // parser
InitSymbols(); InitSymbols();
......
...@@ -402,6 +402,13 @@ void OpenProject(const char *name) ...@@ -402,6 +402,13 @@ void OpenProject(const char *name)
for(int i = PView::list.size() - 1; i >= 0; i--) for(int i = PView::list.size() - 1; i >= 0; i--)
if(PView::list[i]->getData()->hasModel(GModel::current())) if(PView::list[i]->getData()->hasModel(GModel::current()))
delete PView::list[i]; delete PView::list[i];
#endif
#if !defined(HAVE_NO_PARSER)
// reinitialize the parser symbol tree (only if the current model is
// not empty: if it's empty it probably mean we just launched gmsh,
// and we don't want to delete variables set e.g. using the -string
// command line option)
if(GModel::current()->getNumVertices()) InitSymbols();
#endif #endif
GModel::current()->destroy(); GModel::current()->destroy();
GModel::current()->getGEOInternals()->destroy(); GModel::current()->getGEOInternals()->destroy();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment