From 84f6bc097aee1307e537178c947d5516f9e7a88b Mon Sep 17 00:00:00 2001
From: Samuel Jones <samjones714@gmail.com>
Date: Thu, 16 Aug 2018 11:32:20 +0100
Subject: [PATCH] Re #22917 Moved some modified calls to c++ core opposed to
 export

---
 Framework/DataObjects/src/TableWorkspace.cpp                | 6 ++++++
 .../mantid/api/src/Exports/ITableWorkspace.cpp              | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Framework/DataObjects/src/TableWorkspace.cpp b/Framework/DataObjects/src/TableWorkspace.cpp
index 17f38f934a9..037b250a183 100644
--- a/Framework/DataObjects/src/TableWorkspace.cpp
+++ b/Framework/DataObjects/src/TableWorkspace.cpp
@@ -86,6 +86,7 @@ API::Column_sptr TableWorkspace::addColumn(const std::string &type,
     ss << e.what() << '\n';
     throw std::invalid_argument(ss.str());
   }
+  modified();
   return c;
 }
 
@@ -153,6 +154,7 @@ void TableWorkspace::removeColumn(const std::string &name) {
     }
     m_columns.erase(ci);
   }
+  modified();
 }
 
 /** @param index :: Points where to insert the new row.
@@ -164,6 +166,7 @@ size_t TableWorkspace::insertRow(size_t index) {
   for (auto &column : m_columns)
     insertInColumn(column.get(), index);
   ++m_rowCount;
+  modified();
   return index;
 }
 
@@ -178,6 +181,7 @@ void TableWorkspace::removeRow(size_t index) {
   for (auto &column : m_columns)
     removeFromColumn(column.get(), index);
   --m_rowCount;
+  modified();
 }
 
 std::vector<std::string> TableWorkspace::getColumnNames() const {
@@ -196,6 +200,7 @@ void TableWorkspace::addColumn(boost::shared_ptr<API::Column> column) {
     ss << "Column with name " << column->name() << " already exists.\n";
     throw std::invalid_argument(ss.str());
   } else {
+    modified();
     m_columns.push_back(column);
   }
 }
@@ -272,6 +277,7 @@ void TableWorkspace::sort(std::vector<std::pair<std::string, bool>> &criteria) {
   for (size_t i = 0; i < nCols; ++i) {
     getColumn(i)->sortValues(indexVec);
   }
+  modified();
 }
 
 /// Clone the workspace keeping only selected columns.
diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp
index dae3f9202fd..8640618343b 100644
--- a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp
+++ b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp
@@ -183,7 +183,6 @@ bool addColumnPlotType(ITableWorkspace &self, const std::string &type,
   if (column)
     column->setPlotType(plottype);
 
-  self.modified();
   return column != nullptr;
 }
 
@@ -199,7 +198,6 @@ bool addColumnPlotType(ITableWorkspace &self, const std::string &type,
  */
 bool addColumnSimple(ITableWorkspace &self, const std::string &type,
                      const std::string &name) {
-  self.modified();
   return self.addColumn(type, name) != nullptr;
 }
 
@@ -235,7 +233,6 @@ void setPlotType(ITableWorkspace &self, const bpl::object &column, int ptype) {
   } else {
     colptr = self.getColumn(extract<int>(column)());
   }
-
   colptr->setPlotType(ptype);
   self.modified();
 }
@@ -353,7 +350,6 @@ void addRowFromDict(ITableWorkspace &self, const bpl::dict &rowItems) {
     self.removeRow(rowIndex);
     throw;
   }
-  self.modified();
 }
 
 /**
@@ -402,7 +398,6 @@ void addRowFromSequence(ITableWorkspace &self, const bpl::object &rowItems) {
       throw;
     }
   }
-  self.modified();
 }
 
 /**
-- 
GitLab