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

OpenProject does not reset parser variables if we have -string on the command...

OpenProject does not reset parser variables if we have -string on the command line; otherwise always reset them
parent d53bdaad
No related branches found
No related tags found
No related merge requests found
...@@ -624,17 +624,21 @@ void OpenProject(const std::string &fileName) ...@@ -624,17 +624,21 @@ void OpenProject(const std::string &fileName)
Msg::ResetErrorCounter(); Msg::ResetErrorCounter();
if(GModel::current()->empty()){ if(GModel::current()->empty()){
// if the current model is empty, make sure it's reaaally // if the current model is empty, make sure it's reaaally cleaned-up, and
// cleaned-up, and reuse it (don't clear the parser variables: if // reuse it
// the model is empty we probably just launched gmsh, and we don't
// want to delete variables set e.g. using the -string command
// line option)
GModel::current()->destroy(); GModel::current()->destroy();
GModel::current()->getGEOInternals()->destroy(); GModel::current()->getGEOInternals()->destroy();
// don't clear the parser variables if we just launched gmsh with the
// -string command line option
#if defined(HAVE_PARSER)
std::string c = Msg::GetCommandLineArgs();
if(c.find("-string") == std::string::npos)
gmsh_yysymbols.clear();
#endif
} }
else{ else{
// if the current model is not empty make it invisible, clear the // if the current model is not empty make it invisible, clear the parser
// parser variables and add a new model // variables and add a new model
#if defined(HAVE_PARSER) #if defined(HAVE_PARSER)
gmsh_yysymbols.clear(); gmsh_yysymbols.clear();
#endif #endif
...@@ -642,8 +646,7 @@ void OpenProject(const std::string &fileName) ...@@ -642,8 +646,7 @@ void OpenProject(const std::string &fileName)
GModel::current(GModel::list.size() - 1); GModel::current(GModel::list.size() - 1);
} }
// temporary hack until we fill the current GModel on the fly during // temporary hack until we fill the current GModel on the fly during parsing
// parsing
ResetTemporaryBoundingBox(); ResetTemporaryBoundingBox();
// merge the file // merge the file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment