From 5004c22656dbc9b349c1291770cbc8ce391f90c5 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 5 May 2015 04:46:13 +0000 Subject: [PATCH] clear FunctionManager in OpenFile --- Common/OpenFile.cpp | 2 ++ Parser/FunctionManager.cpp | 5 +++++ Parser/FunctionManager.h | 1 + 3 files changed, 8 insertions(+) diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 8cee8b6a6a..a1fc73ac99 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -27,6 +27,7 @@ #if defined(HAVE_PARSER) #include "Parser.h" +#include "FunctionManager.h" #endif #if defined(HAVE_MESH) @@ -679,6 +680,7 @@ void OpenProject(const std::string &fileName, bool setWindowTitle) std::map<std::string, std::string> cls(Msg::GetCommandLineStrings()); for(std::map<std::string, std::string>::iterator it = cls.begin(); it != cls.end(); it++) gmsh_yystringsymbols[it->first] = it->second; + FunctionManager::Instance()->clear(); #endif // temporary hack until we fill the current GModel on the fly during parsing diff --git a/Parser/FunctionManager.cpp b/Parser/FunctionManager.cpp index 835452a99c..d17141d325 100644 --- a/Parser/FunctionManager.cpp +++ b/Parser/FunctionManager.cpp @@ -45,6 +45,11 @@ FunctionManager *FunctionManager::Instance() return instance; } +void FunctionManager::clear() +{ + functions->m.clear(); +} + int FunctionManager::enterFunction(const std::string &name, gmshFILE * f, std::string &filename, int &lno) const { diff --git a/Parser/FunctionManager.h b/Parser/FunctionManager.h index 328f6972c5..c03882edd5 100644 --- a/Parser/FunctionManager.h +++ b/Parser/FunctionManager.h @@ -27,6 +27,7 @@ class FunctionManager int enterFunction(const std::string &name, gmshFILE *f, std::string &filename, int &lineno) const; int leaveFunction(gmshFILE *f, std::string &filename, int &lineno); + void clear(); }; #endif -- GitLab