]> git.lyx.org Git - lyx.git/commitdiff
fix memory leaks
authorPeter Kümmel <syntheticpp@gmx.net>
Sun, 2 Dec 2007 18:39:05 +0000 (18:39 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sun, 2 Dec 2007 18:39:05 +0000 (18:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21928 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiFontLoader.cpp
src/frontends/qt4/GuiFontLoader.h
src/frontends/qt4/GuiToc.cpp
src/frontends/qt4/GuiToc.h
src/frontends/qt4/GuiWorkArea.cpp

index c6757809b357989c705cd508e1958953ff290134..aaa2d59f0dc36a6ea393d5e624b68cdc56115467 100644 (file)
@@ -224,6 +224,11 @@ void GuiFontLoader::update()
 }
 
 
+GuiFontLoader::~GuiFontLoader()
+{
+       update();
+}
+
 /////////////////////////////////////////////////
 
 
index 867ac3dd3c3b61d2bacb40804878c8231268dd85..b48bfd4cfd18351dd84d92c4d2b59304ac2c69cf 100644 (file)
@@ -51,7 +51,7 @@ public:
        GuiFontLoader();
 
        /// Destructor
-       virtual ~GuiFontLoader() {}
+       virtual ~GuiFontLoader();
 
        virtual void update();
        virtual bool available(FontInfo const & f);
index 73c6b0331bf2059cd889160c53f938dec776cb99..78ed45c50fc0b60c5cc3f40c11f6f12e456d86d7 100644 (file)
@@ -52,10 +52,21 @@ GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
 
 GuiToc::~GuiToc()
 {
+       clearTocModels();
        delete widget_;
 }
 
 
+void GuiToc::clearTocModels()
+{
+       const unsigned int size = toc_models_.size();
+       for (unsigned int i = 0; i < size; ++i) {
+               delete toc_models_[i];
+       }
+       toc_models_.clear();
+}
+
+
 int GuiToc::getTocDepth(int type)
 {
        if (type < 0)
@@ -134,7 +145,7 @@ bool GuiToc::initialiseParams(string const & data)
 
        types_.clear();
        type_names_.clear();
-       toc_models_.clear();
+       clearTocModels();
        TocList const & tocs = buffer().masterBuffer()->tocBackend().tocs();
        TocList::const_iterator it = tocs.begin();
        TocList::const_iterator end = tocs.end();
index e3b3f643f713e89600781fec1f434af0956a4115..f73291f48f439433d0525cb16a31a2a34bccaedc 100644 (file)
@@ -72,6 +72,8 @@ private:
        TocWidget * widget_;
        ///
        std::vector<TocModel *> toc_models_;
+       ///             
+       void clearTocModels();
 
 public:
        ///
index 7fec5d95a74d37da843912902ba2bdd3f32bd1b2..2c53eb524ff99b995b1e6a4b8e0073ae0ffb8367 100644 (file)
@@ -251,6 +251,7 @@ GuiWorkArea::~GuiWorkArea()
 {
        buffer_view_->buffer().workAreaManager().remove(this);
        delete buffer_view_;
+       delete cursor_;
 }