fix memory leaks

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21928 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2007-12-02 18:39:05 +00:00
parent a9efaa00e8
commit 4b465cfc26
5 changed files with 21 additions and 2 deletions

View File

@ -224,6 +224,11 @@ void GuiFontLoader::update()
}
GuiFontLoader::~GuiFontLoader()
{
update();
}
/////////////////////////////////////////////////

View File

@ -51,7 +51,7 @@ public:
GuiFontLoader();
/// Destructor
virtual ~GuiFontLoader() {}
virtual ~GuiFontLoader();
virtual void update();
virtual bool available(FontInfo const & f);

View 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();

View File

@ -72,6 +72,8 @@ private:
TocWidget * widget_;
///
std::vector<TocModel *> toc_models_;
///
void clearTocModels();
public:
///

View File

@ -251,6 +251,7 @@ GuiWorkArea::~GuiWorkArea()
{
buffer_view_->buffer().workAreaManager().remove(this);
delete buffer_view_;
delete cursor_;
}