a leak in DocumentClassBundle.

However, I am not really sure we should care about these. It's not much
difference, except that application shutdown in slower after 'fixing'
them.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24305 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-04-16 21:23:45 +00:00
parent f227ebb021
commit b8c086b363
3 changed files with 43 additions and 11 deletions

View File

@ -214,8 +214,8 @@ struct BufferView::Private
{
Private(BufferView & bv): wh_(0), cursor_(bv),
anchor_pit_(0), anchor_ypos_(0),
inlineCompletionUniqueChars(0)
last_inset_(0), gui_(0),
inlineCompletionUniqueChars_(0),
last_inset_(0), gui_(0)
{}
///

View File

@ -117,6 +117,12 @@ docstring const TextClass::emptylayout_ = from_ascii("Plain Layout");
InsetLayout DocumentClass::empty_insetlayout_;
/////////////////////////////////////////////////////////////////////////
//
// TextClass
//
/////////////////////////////////////////////////////////////////////////
TextClass::TextClass()
{
outputType_ = LATEX;
@ -1035,23 +1041,36 @@ Layout const & TextClass::defaultLayout() const
}
bool TextClass::isDefaultLayout(Layout const & lay) const
bool TextClass::isDefaultLayout(Layout const & layout) const
{
return lay.name() == defaultLayoutName();
return layout.name() == defaultLayoutName();
}
bool TextClass::isEmptyLayout(Layout const & lay) const
bool TextClass::isEmptyLayout(Layout const & layout) const
{
return lay.name() == emptyLayoutName();
return layout.name() == emptyLayoutName();
}
/////////////////////////////////////////////////////////////////////////
//
// DocumentClassBundle
//
/////////////////////////////////////////////////////////////////////////
DocumentClassBundle::~DocumentClassBundle()
{
for (size_t i = 0; i != documentClasses_.size(); ++i)
delete documentClasses_[i];
documentClasses_.clear();
}
DocumentClass & DocumentClassBundle::newClass(LayoutFile const & baseClass)
{
DocumentClass * dc = new DocumentClass(baseClass);
tc_list_.push_back(dc);
return *tc_list_.back();
documentClasses_.push_back(dc);
return *documentClasses_.back();
}
@ -1062,6 +1081,12 @@ DocumentClassBundle & DocumentClassBundle::get()
}
/////////////////////////////////////////////////////////////////////////
//
// DocumentClass
//
/////////////////////////////////////////////////////////////////////////
DocumentClass::DocumentClass(LayoutFile const & tc)
: TextClass(tc)
{}
@ -1090,6 +1115,12 @@ bool DocumentClass::hasTocLevels() const
}
/////////////////////////////////////////////////////////////////////////
//
// PageSides
//
/////////////////////////////////////////////////////////////////////////
ostream & operator<<(ostream & os, PageSides p)
{
switch (p) {

View File

@ -24,7 +24,6 @@
#include <boost/noncopyable.hpp>
#include <list>
#include <map>
#include <set>
#include <vector>
@ -364,7 +363,7 @@ protected:
/// Constructs a DocumentClass based upon a LayoutFile.
DocumentClass(LayoutFile const & tc);
/// Needed in tex2lyx
DocumentClass() {};
DocumentClass() {}
private:
/// The only class that can create a DocumentClass is
/// DocumentClassBundle, which calls the protected constructor.
@ -393,8 +392,10 @@ public:
private:
/// control instantiation
DocumentClassBundle() {}
/// clean up
~DocumentClassBundle();
///
std::list<DocumentClass *> tc_list_;
std::vector<DocumentClass *> documentClasses_;
};