diff --git a/src/LyX.cpp b/src/LyX.cpp index 8db6eefe78..7e56d550ee 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -44,6 +44,7 @@ #include "Server.h" #include "ServerSocket.h" #include "Session.h" +#include "WordList.h" #include "frontends/alert.h" #include "frontends/Application.h" @@ -217,6 +218,7 @@ LyX::~LyX() { delete pimpl_; singleton_ = 0; + WordList::cleanupWordLists(); } @@ -446,8 +448,7 @@ void LyX::prepareExit() // Kill the application object before exiting. This avoids crashes // when exiting on Linux. - if (pimpl_->application_) - pimpl_->application_.reset(); + pimpl_->application_.reset(); } diff --git a/src/WordList.cpp b/src/WordList.cpp index 2f8ce2bd52..191dc33b83 100644 --- a/src/WordList.cpp +++ b/src/WordList.cpp @@ -30,6 +30,7 @@ namespace lyx { /// map theGlobalWordList; + WordList * theWordList(Language const & lang) { map::iterator it = theGlobalWordList.find(lang); @@ -40,6 +41,15 @@ WordList * theWordList(Language const & lang) return theGlobalWordList[lang]; } + +void WordList::cleanupWordLists() { + map::const_iterator it = theGlobalWordList.begin(); + for (; it != theGlobalWordList.end(); ++it) + delete it->second; + theGlobalWordList.clear(); +} + + /// struct WordList::Impl { /// diff --git a/src/WordList.h b/src/WordList.h index 7bef7f34aa..b7f88fb78f 100644 --- a/src/WordList.h +++ b/src/WordList.h @@ -33,7 +33,9 @@ public: void insert(docstring const & w); /// void remove(docstring const & w); - + /// + static void cleanupWordLists(); + private: struct Impl; Impl * d;