[gnote] * Plugged various memory leaks.
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] * Plugged various memory leaks.
- Date: Thu, 30 Apr 2009 03:46:10 -0400 (EDT)
commit 049142205f571573d79f68609a8129a407d30852
Author: Hubert Figuiere <hub figuiere net>
Date: Thu Apr 30 03:22:03 2009 -0400
* Plugged various memory leaks.
---
NEWS | 1 +
src/addinmanager.cpp | 27 ++++++++++++++++-----------
src/addinmanager.hpp | 1 +
src/notewindow.cpp | 1 +
4 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/NEWS b/NEWS
index b578511..858ec4f 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Fixes:
* Missing header in src/addins/inserttimestamp/inserttimestampnoteaddin.cpp
* Don't crash when deleting a note (Closes #579839)
+ * Plugged various memory leaks.
Translations:
diff --git a/src/addinmanager.cpp b/src/addinmanager.cpp
index e41016a..6aec7f2 100644
--- a/src/addinmanager.cpp
+++ b/src/addinmanager.cpp
@@ -34,9 +34,10 @@
namespace gnote {
-#define REGISTER_NOTE_ADDIN(klass) \
- m_note_addin_infos.insert(std::make_pair(typeid(klass).name(), \
- new sharp::IfaceFactory<klass>))
+#define REGISTER_BUILTIN_NOTE_ADDIN(klass) \
+ do { sharp::IfaceFactoryBase *iface = new sharp::IfaceFactory<klass>; \
+ m_builtin_ifaces.push_back(iface); \
+ m_note_addin_infos.insert(std::make_pair(typeid(klass).name(),iface)); } while(0)
#define REGISTER_APP_ADDIN(klass) \
m_app_addins.insert(std::make_pair(typeid(klass).name(), \
@@ -57,20 +58,24 @@ namespace gnote {
boost::bind(&boost::checked_delete<NoteAddin>, _1));
}
sharp::map_delete_all_second(m_addin_prefs);
+ for(std::list<sharp::IfaceFactoryBase*>::iterator iter = m_builtin_ifaces.begin();
+ iter != m_builtin_ifaces.end(); ++iter) {
+ delete *iter;
+ }
}
void AddinManager::initialize_sharp_addins()
{
// get the factory
- REGISTER_NOTE_ADDIN(NoteRenameWatcher);
- REGISTER_NOTE_ADDIN(NoteSpellChecker);
- REGISTER_NOTE_ADDIN(NoteUrlWatcher);
- REGISTER_NOTE_ADDIN(NoteLinkWatcher);
- REGISTER_NOTE_ADDIN(NoteWikiWatcher);
- REGISTER_NOTE_ADDIN(MouseHandWatcher);
- REGISTER_NOTE_ADDIN(NoteTagsWatcher);
- REGISTER_NOTE_ADDIN(notebooks::NotebookNoteAddin);
+ REGISTER_BUILTIN_NOTE_ADDIN(NoteRenameWatcher);
+ REGISTER_BUILTIN_NOTE_ADDIN(NoteSpellChecker);
+ REGISTER_BUILTIN_NOTE_ADDIN(NoteUrlWatcher);
+ REGISTER_BUILTIN_NOTE_ADDIN(NoteLinkWatcher);
+ REGISTER_BUILTIN_NOTE_ADDIN(NoteWikiWatcher);
+ REGISTER_BUILTIN_NOTE_ADDIN(MouseHandWatcher);
+ REGISTER_BUILTIN_NOTE_ADDIN(NoteTagsWatcher);
+ REGISTER_BUILTIN_NOTE_ADDIN(notebooks::NotebookNoteAddin);
REGISTER_APP_ADDIN(notebooks::NotebookApplicationAddin);
diff --git a/src/addinmanager.hpp b/src/addinmanager.hpp
index c4b623f..9a00b3c 100644
--- a/src/addinmanager.hpp
+++ b/src/addinmanager.hpp
@@ -64,6 +64,7 @@ private:
const std::string m_gnote_conf_dir;
sharp::ModuleManager m_module_manager;
+ std::list<sharp::IfaceFactoryBase*> m_builtin_ifaces;
/// Key = TypeExtensionNode.Id
typedef std::map<std::string, ApplicationAddin*> AppAddinMap;
AppAddinMap m_app_addins;
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index d847a91..bc56357 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -194,6 +194,7 @@ namespace gnote {
NoteWindow::~NoteWindow()
{
delete m_global_keys;
+ delete m_mark_set_timeout;
Preferences::obj().remove_notify(m_gconf_notify);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]