[glom/choices_celllayout] ComboEntry: Fix silly typo.



commit 43279039e0fe5e6a2ab0dd9433ff96f5d4abb09d
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Oct 4 00:33:42 2010 +0200

    ComboEntry: Fix silly typo.
    
    * glom/mode_data/datawidget/comboentry.cc: Remove left-over for() loop.

 ChangeLog                                          |    6 ++++++
 .../datawidget/combochoiceswithtreemodel.cc        |    6 ++++++
 glom/mode_data/datawidget/comboentry.cc            |    6 ++++--
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 13606da..7b2fa64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-04  Murray Cumming  <murrayc murrayc com>
+
+	ComboEntry: Fix silly typo.
+
+	* glom/mode_data/datawidget/comboentry.cc: Remove left-over for() loop.
+
 2010-10-03  Murray Cumming  <murrayc murrayc com>
 
 	Choices: Fix the custom tree model.
diff --git a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
index 51db612..7422a58 100644
--- a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
+++ b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
@@ -340,6 +340,12 @@ void ComboChoicesWithTreeModel::on_cell_data(const Gtk::TreeModel::iterator& ite
 
 void ComboChoicesWithTreeModel::cell_connect_cell_data_func(Gtk::CellLayout* celllayout, Gtk::CellRenderer* cell, guint model_column_index)
 {
+  if(model_column_index >= m_db_layout_items.size())
+  {
+    std::cerr << G_STRFUNC << ": model_column_index (" << model_column_index << ") is out of range. size=" << m_db_layout_items.size() << std::endl;
+    return;
+  }
+  
   celllayout->set_cell_data_func(*cell,
     sigc::bind( sigc::mem_fun(*this, &ComboChoicesWithTreeModel::on_cell_data), cell, model_column_index));
 }
diff --git a/glom/mode_data/datawidget/comboentry.cc b/glom/mode_data/datawidget/comboentry.cc
index 3b0325f..4968bb2 100644
--- a/glom/mode_data/datawidget/comboentry.cc
+++ b/glom/mode_data/datawidget/comboentry.cc
@@ -183,8 +183,8 @@ void ComboEntry::set_choices_related(const Document* document, const sharedptr<c
     return;
   }
   
-  const guint columns_count = model->get_n_columns();
-  for(guint i = 0; i < columns_count; ++i)
+  //const guint columns_count = model->get_n_columns();
+  guint i = 0;
   for(type_vec_const_layout_items::const_iterator iter = m_db_layout_items.begin(); iter != m_db_layout_items.end(); ++iter)
   {
     const sharedptr<const LayoutItem> layout_item = *iter;
@@ -214,6 +214,8 @@ void ComboEntry::set_choices_related(const Document* document, const sharedptr<c
       
       cell_connect_cell_data_func(this, cell, i);
     }
+    
+    ++i;
   }
 }
 



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