Hello everyone,

I am using QT to manage a connection to a MS Access Database. It is reading data without issue, issue comes after using a record to

Code is below. I get the exception in attached image when the records destructor is called. I tried calling clear on the record after use, but that also created a issue.

ErrorMsg.jpg

Below is method concerned


Qt Code:
  1. void DataManager::setRelationalTableData(std::unique_ptr<tableData> data)
  2. {
  3. if (HelperFunctions::tableNameMatchesEnum(mCurrentRelationalTableModel->tableName(), data->tableName))
  4. {
  5. mCurrentRelationalTableModel->setEditStrategy(QSqlTableModel::EditStrategy::OnManualSubmit);
  6.  
  7. for (ushort row = 0; row < mCurrentRelationalTableModel->rowCount(); row++)
  8. {
  9. auto relateTableRecord = mCurrentRelationalTableModel->record(row);
  10. auto tableData = data->tableContents.find(row);
  11.  
  12. for (ushort dataItr = 0; dataItr < data->tableContents.size(); dataItr++)
  13. {
  14. relateTableRecord.setValue(QString::fromStdString(data->tableHeaders.at(dataItr)), QString::fromStdString(tableData->second.at(dataItr)));
  15. }
  16. mCurrentRelationalTableModel->setRecord(row, relateTableRecord);
  17. }
  18. mCurrentRelationalTableModel->submitAll();
  19. }
  20.  
  21. }
To copy to clipboard, switch view to plain text mode 

EDIT:: The relationaltablemodel is being updated with new data, although this is never submitted as the crash occurs before submitall

Many thanks in advance