[glom] Base_Db: Add clear_fields_calculation_in_progress().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Base_Db: Add clear_fields_calculation_in_progress().
- Date: Thu, 5 Nov 2015 22:21:26 +0000 (UTC)
commit 0773175546802705e5add1576958394032915e2b
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Nov 3 17:59:17 2015 +0100
Base_Db: Add clear_fields_calculation_in_progress().
Instead of directly accessing the member variable just to call clear()
on it.
glom/base_db.cc | 11 ++++++++---
glom/base_db.h | 4 +++-
glom/mode_data/box_data_details.cc | 4 ++--
3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/glom/base_db.cc b/glom/base_db.cc
index f9108fa..97f55bf 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -775,7 +775,7 @@ void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, co
{
field_in_record.m_key_value = primary_key_value;
- m_FieldsCalculationInProgress.clear();
+ clear_fields_calculation_in_progress();
calculate_field(field_in_record);
}
}
@@ -1104,7 +1104,7 @@ void Base_DB::do_calculations(const LayoutFieldInRecord& field_changed, bool fir
if(first_calc_field)
{
//g_warning(" clearing m_FieldsCalculationInProgress");
- m_FieldsCalculationInProgress.clear();
+ clear_fields_calculation_in_progress();
}
//Recalculate fields that are triggered by a change of this field's value, not including calculations that
these calculations use.
@@ -1124,7 +1124,7 @@ void Base_DB::do_calculations(const LayoutFieldInRecord& field_changed, bool fir
}
if(first_calc_field)
- m_FieldsCalculationInProgress.clear();
+ clear_fields_calculation_in_progress();
}
Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::ustring& table_name, const
std::shared_ptr<const LayoutItem_Field>& field)
@@ -1515,6 +1515,11 @@ Glib::ustring Base_DB::get_active_layout_platform(Document* document)
return result;
}
+void Base_DB::clear_fields_calculation_in_progress()
+{
+ m_FieldsCalculationInProgress.clear();
+}
+
} //namespace Glom
diff --git a/glom/base_db.h b/glom/base_db.h
index 1e47fd8..e109a85 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -87,6 +87,8 @@ public:
protected:
+ void clear_fields_calculation_in_progress();
+
typedef std::list< std::shared_ptr<LayoutItem_Field> > type_list_field_items;
typedef std::list< std::shared_ptr<const LayoutItem_Field> > type_list_const_field_items;
@@ -311,7 +313,7 @@ protected:
static void handle_error(const std::exception& ex, Gtk::Window* parent); //TODO_port: This is probably
useless now.
static bool handle_error();
-protected:
+private:
type_field_calcs m_FieldsCalculationInProgress; //Prevent circular calculations and recalculations.
};
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 90fc32a..0cb8b31 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -509,7 +509,7 @@ Gnome::Gda::Value Box_Data_Details::get_primary_key_value_selected() const
void Box_Data_Details::recalculate_fields_for_related_records(const Glib::ustring& relationship_name)
{
- m_FieldsCalculationInProgress.clear();
+ clear_fields_calculation_in_progress();
//Check all fields in the parent table:
const auto primary_key_value = get_primary_key_value_selected();
@@ -536,7 +536,7 @@ void Box_Data_Details::recalculate_fields_for_related_records(const Glib::ustrin
}
}
- m_FieldsCalculationInProgress.clear();
+ clear_fields_calculation_in_progress();
}
void Box_Data_Details::on_related_record_added(Gnome::Gda::Value /* strKeyValue */, Glib::ustring /*
strFromKeyName */)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]