[solang] Fixed crash when trying to edit a tag without selecting one



commit 0cd5f4ab1f186cb06d30477d0f447be83c44d7b5
Author: Debarshi Ray <rishi gnu org>
Date:   Fri Jan 22 01:12:35 2010 +0200

    Fixed crash when trying to edit a tag without selecting one
    
    Fixed TagManager::on_action_tag_edit to use the same approach of
    iterating over selected paths as TagManager::on_action_tag_delete.
    This keeps the code consistent, fixes the crash, and if we allow
    multiple tags to be selected in future then this code need not be
    changed.

 src/attribute/tag-manager.cpp |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/attribute/tag-manager.cpp b/src/attribute/tag-manager.cpp
index 2f3c6ec..8ed866c 100644
--- a/src/attribute/tag-manager.cpp
+++ b/src/attribute/tag-manager.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
- * Copyright (C) 2009 Debarshi Ray <rishi gnu org>
+ * Copyright (C) 2009, 2010 Debarshi Ray <rishi gnu org>
  * 
  * Solang is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -278,13 +278,18 @@ TagManager::on_action_tag_edit() throw()
     Glib::RefPtr<Gtk::TreeSelection> selected
                                             = tagView_.get_selection();
 
-    Gtk::TreeModel::iterator item = selected->get_selected();
     const TagViewModelColumnRecord &rec
                                 = tagView_.get_column_records();
 
-    if( item != selected->get_model()->children().end() )
+    const TreeModelPtr model = tagView_.get_model();
+    const TreePathList selected_rows = selected->get_selected_rows();
+
+    for (TreePathList::const_iterator iter = selected_rows.begin();
+         selected_rows.end() != iter;
+         iter++)
     {
-        Gtk::TreeModel::Row row= (*item);
+        Gtk::TreeModel::iterator model_iter = model->get_iter(*iter);
+        Gtk::TreeModel::Row row = *model_iter;
         TagPtr tag = row[ rec.get_column_tag() ];
 
         TagNewDialog tag_new_dialog( tag );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]