Unverified Commit d07e354f authored by Murray Cumming's avatar Murray Cumming
Browse files

Document:remove_field(): Remove from the vector, not a copy.

And test this.
This regression was probably introduced by the conversion to use
auto with C++11.
parent ae4fa610
......@@ -724,7 +724,7 @@ void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring
const auto table_info = get_table_info(table_name);
auto vecFields = table_info->m_fields;
auto& vecFields = table_info->m_fields;
auto iterFind = find_if_same_name(vecFields, field_name);
if(iterFind != vecFields.end()) //If it was found:
......@@ -169,6 +169,15 @@ int main()
//Remove a field from the whole document:
document.remove_field("publisher", "publisher_id");
//Check that the old field name is not used.
auto field =
document.get_field("publisher", "publisher_id");
if (field) {
std::cerr << G_STRFUNC << ": Failure: The removed field name still exists.\n";
if(field_is_on_a_layout(document, "publisher", "publisher_id"))
std::cerr << G_STRFUNC << ": Failure: The removed field name is still used on a layout." << std::endl;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment