mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
fix some memory leaks
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24299 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bdc6d56cc7
commit
c72634f95e
@ -47,6 +47,14 @@ LayoutFile::LayoutFile(string const & fn, string const & cln,
|
|||||||
texClassAvail_ = texClassAvail;
|
texClassAvail_ = texClassAvail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LayoutFileList::~LayoutFileList()
|
||||||
|
{
|
||||||
|
ClassMap::const_iterator it = classmap_.begin();
|
||||||
|
ClassMap::const_iterator en = classmap_.end();
|
||||||
|
for (; it != en; ++it) {
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LayoutFileList & LayoutFileList::get()
|
LayoutFileList & LayoutFileList::get()
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,7 @@ class LayoutFileList {
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
LayoutFileList() {}
|
LayoutFileList() {}
|
||||||
|
~LayoutFileList();
|
||||||
/// \return The sole instance of this class.
|
/// \return The sole instance of this class.
|
||||||
static LayoutFileList & get();
|
static LayoutFileList & get();
|
||||||
///
|
///
|
||||||
|
@ -58,6 +58,8 @@
|
|||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -1187,7 +1189,7 @@ struct Menus::Impl {
|
|||||||
///
|
///
|
||||||
MenuDefinition menubar_;
|
MenuDefinition menubar_;
|
||||||
|
|
||||||
typedef QMap<GuiView *, QHash<QString, Menu *> > NameMap;
|
typedef QMap<GuiView *, QHash<QString, boost::shared_ptr<Menu> > > NameMap;
|
||||||
|
|
||||||
/// name to menu for \c menu() method.
|
/// name to menu for \c menu() method.
|
||||||
NameMap name_map_;
|
NameMap name_map_;
|
||||||
@ -1400,6 +1402,10 @@ MenuDefinition & Menus::Impl::getMenu(QString const & name)
|
|||||||
|
|
||||||
Menus::Menus() : d(new Impl) {}
|
Menus::Menus() : d(new Impl) {}
|
||||||
|
|
||||||
|
Menus::~Menus()
|
||||||
|
{
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
void Menus::read(Lexer & lex)
|
void Menus::read(Lexer & lex)
|
||||||
{
|
{
|
||||||
@ -1513,7 +1519,7 @@ void Menus::fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial)
|
|||||||
menu->setTitle(label(*m));
|
menu->setTitle(label(*m));
|
||||||
qmb->addMenu(menu);
|
qmb->addMenu(menu);
|
||||||
|
|
||||||
d->name_map_[view][name] = menu;
|
d->name_map_[view][name] = boost::shared_ptr<Menu>(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1548,14 +1554,14 @@ void Menus::updateMenu(Menu * qmenu)
|
|||||||
Menu * Menus::menu(QString const & name, GuiView & view)
|
Menu * Menus::menu(QString const & name, GuiView & view)
|
||||||
{
|
{
|
||||||
LYXERR(Debug::GUI, "Context menu requested: " << fromqstr(name));
|
LYXERR(Debug::GUI, "Context menu requested: " << fromqstr(name));
|
||||||
Menu * menu = d->name_map_[&view].value(name, 0);
|
Menu * menu = d->name_map_[&view].value(name, boost::shared_ptr<Menu>()).get();
|
||||||
if (!menu && !name.startsWith("context-")) {
|
if (!menu && !name.startsWith("context-")) {
|
||||||
LYXERR0("requested context menu not found: " << fromqstr(name));
|
LYXERR0("requested context menu not found: " << fromqstr(name));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu = new Menu(&view, name, true);
|
menu = new Menu(&view, name, true);
|
||||||
d->name_map_[&view][name] = menu;
|
d->name_map_[&view][name] = boost::shared_ptr<Menu>(menu);
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class Menus
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Menus();
|
Menus();
|
||||||
|
~Menus();
|
||||||
|
|
||||||
///
|
///
|
||||||
bool searchMenu(FuncRequest const & func,
|
bool searchMenu(FuncRequest const & func,
|
||||||
|
Loading…
Reference in New Issue
Block a user