commit b7af21ad7c0a9c26600584ed122772214d1da9ef
Author: Pavel Sanda <sa...@lyx.org>
Date:   Tue Feb 18 10:03:42 2020 +0100

    Fix memory leak.
    
    Spotted by Scott.
    https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210447.html
---
 src/frontends/qt/TocModel.cpp |    7 +++++++
 src/frontends/qt/TocModel.h   |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/frontends/qt/TocModel.cpp b/src/frontends/qt/TocModel.cpp
index 1974422..16990b8 100644
--- a/src/frontends/qt/TocModel.cpp
+++ b/src/frontends/qt/TocModel.cpp
@@ -336,6 +336,13 @@ void TocModels::updateItem(QString const & type, 
DocIterator const & dit)
        models_[type]->updateItem(dit);
 }
 
+TocModels::~TocModels(){
+       QHashIterator<QString, TocModel *> iter(models_);
+       while(iter.hasNext()) {
+               iter.next();
+               delete iter.value();
+       }
+}
 
 void TocModels::reset(BufferView const * bv)
 {
diff --git a/src/frontends/qt/TocModel.h b/src/frontends/qt/TocModel.h
index 8d33639..ad65cdc 100644
--- a/src/frontends/qt/TocModel.h
+++ b/src/frontends/qt/TocModel.h
@@ -113,6 +113,7 @@ class TocModels : public QObject
 public:
        ///
        TocModels();
+       ~TocModels();
        ///
        void reset(BufferView const * bv);
        ///
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to