[gnote] Fix NotebookManager::get_notebooks_iter
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix NotebookManager::get_notebooks_iter
- Date: Thu, 30 Dec 2010 20:45:02 +0000 (UTC)
commit 8d70d89f95c85230014cf3de6401f2cd5d8107e3
Author: Aurimas Ä?ernius <aurisc4 gmail com>
Date: Wed Dec 29 23:33:59 2010 +0200
Fix NotebookManager::get_notebooks_iter
Returned iterator is unusable, because it point to incorrect container.
Iterator should point to element in m_sortedNotebooks.
Fixes Bug 625679.
src/notebooks/notebookmanager.cpp | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/notebooks/notebookmanager.cpp b/src/notebooks/notebookmanager.cpp
index 9521da8..28ff689 100644
--- a/src/notebooks/notebookmanager.cpp
+++ b/src/notebooks/notebookmanager.cpp
@@ -1,6 +1,7 @@
/*
* gnote
*
+ * Copyright (C) 2010 Aurimas Cernius
* Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
@@ -190,12 +191,15 @@ namespace gnote {
bool NotebookManager::get_notebook_iter(const Notebook::Ptr & notebook,
Gtk::TreeIter & iter)
{
- std::string normalized_name = notebook->get_normalized_name();
- std::map<std::string, Gtk::TreeIter>::iterator map_iter
- = m_notebookMap.find (normalized_name);
- if (map_iter != m_notebookMap.end()) {
- iter = map_iter->second;
- return true;
+ Gtk::TreeNodeChildren notebooks = m_sortedNotebooks->children();
+ for (Gtk::TreeIter notebooks_iter = notebooks.begin();
+ notebooks_iter != notebooks.end(); ++notebooks_iter) {
+ Notebook::Ptr current_notebook;
+ notebooks_iter->get_value(0, current_notebook);
+ if (current_notebook == notebook) {
+ iter = notebooks_iter;
+ return true;
+ }
}
iter = Gtk::TreeIter();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]