[glom/feature_choices_related_layout] Dialog_FieldsList: Fix a crash.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/feature_choices_related_layout] Dialog_FieldsList: Fix a crash.
- Date: Tue, 7 Sep 2010 13:49:52 +0000 (UTC)
commit a1974b260165a3b335632f08f7b416b5aaaf03d3
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Sep 7 15:49:16 2010 +0200
Dialog_FieldsList: Fix a crash.
* glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc: get_fields():
Do not overwrite the vector, fixing a crash.
Looking at this code, I think we also ignore reordering of items, so we
should fix that later.
ChangeLog | 9 +++++++++
.../layout_item_dialogs/dialog_fieldslist.cc | 10 ++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d21f24b..dc80590 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2010-09-07 Murray Cumming <murrayc murrayc com>
+ Dialog_FieldsList: Fix a crash.
+
+ * glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc: get_fields():
+ Do not overwrite the vector, fixing a crash.
+ Looking at this code, I think we also ignore reordering of items, so we
+ should fix that later.
+
+2010-09-07 Murray Cumming <murrayc murrayc com>
+
Add a --stop-auto-server-shutdown command-line option for debugging.
* glom/libglom/connectionpool.[h|cc]: Added set_auto_server_shutdown().
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
index ca146e7..cdc0de1 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
@@ -189,10 +189,12 @@ void Dialog_FieldsList::on_button_field_down()
LayoutGroup::type_list_items Dialog_FieldsList::get_fields() const
{
- LayoutGroup::type_list_items result;
- guint field_sequence = 1; //0 means no sequence
- for(Gtk::TreeModel::iterator iterFields = m_model_fields->children().begin(); iterFields != m_model_fields->children().end(); ++iterFields)
+ const Gtk::TreeModel::Children children = m_model_fields->children();
+ LayoutGroup::type_list_items result(children.size());
+
+ guint field_sequence = 0;
+ for(Gtk::TreeModel::iterator iterFields = m_model_fields->children().begin(); iterFields != children.end(); ++iterFields)
{
Gtk::TreeModel::Row row = *iterFields;
@@ -202,6 +204,7 @@ LayoutGroup::type_list_items Dialog_FieldsList::get_fields() const
{
sharedptr<LayoutItem_Field> field_copy = glom_sharedptr_clone(item);
+ //TODO: This seems to overwrite the sequence set when the user reorders an item.
result[field_sequence] = field_copy;
++field_sequence;
@@ -218,7 +221,6 @@ void Dialog_FieldsList::on_treeview_fields_selection_changed()
void Dialog_FieldsList::on_button_add_field()
{
- std::cout << "debug: " << m_table_name << std::endl;
//Get the chosen fields:
type_list_field_items fields_list = offer_field_list(m_table_name, this);
for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end(); ++iter_chosen)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]