In TestGroup_Person, when I retrieve a QSharedPointer<-JB_TableRowProt> from JB_PersonDao and assign it to QSharedPointer<-JB_TableRowProt> aGroup_Person (in .h), I then get this error in the methods of TestGroup_Person.
Alternatively, if I retrieve a QSharedPointer<-JB_TableRowProt> from JB_DaoProt in each method (and don't assign it to QSharedPointer<-JB_TableRowProt> aGroup_Person), it works fine.
Can someone explain to me why this assignment appears to be causing the error please?
I got this error:
QFATAL : TestGroup_Person::test_getDBTable_Name() Received signal 11
         Function time: 0ms Total time: 0ms
FAIL!  : TestGroup_Person::test_getDBTable_Name() Received a fatal error.
Here's the code: main:
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QStringList arguments = QCoreApplication::arguments();
    QFile aFile(DATABASE_FILENAME);  // remove existing SP3.db
    if (aFile.exists())
        aFile.remove();
    map<QString, unique_ptr<QObject>> tests;
    tests.emplace("group_person", make_unique<TestGroup_Person>());
    if (arguments.size() >= 3 && arguments[1] == "-select") {
        QString testName = arguments[2];
        auto iter = tests.begin();
        while(iter != tests.end()) {
            if (iter->first != testName) {
                iter = tests.erase(iter);
            } else {
                ++iter;
            }
        }
        arguments.removeOne("-select");
        arguments.removeOne(testName);
    }
    int status = 0;
        for(auto& test : tests) {
            status |= QTest::qExec(test.second.get(), arguments);
        }
    return status;
    }
TestGroup_Person.h
#include <QString>
#include <QtTest>
#include <QSharedPointer>
#include "A_DB_Classes/JB_DatabaseManager.h"
#include "A_Tables/JB_Group_Person.h"
class TestGroup_Person : public QObject
{
    Q_OBJECT
public:
    TestGroup_Person();
private Q_SLOTS:
    void test_allFieldsEqualsFieldNames();
    void test_getDBTable_FieldNames();
    void test_getDBTable_Name();
    void test_hasJoinTable();
    void test_setValueForField();
    void test_setStorageValueForField();
    void test_getStorageFields();
private:
    JB_DatabaseManager& mDB;
    QSharedPointer<JB_TableRowProt> aGroup_Person;
};
TestGroup_Person.cpp:
TestGroup_Person::TestGroup_Person():
mDB(JB_DatabaseManager::instance())
{
    aGroup_Person = mDB.aPersonDao.getJoinTableObject();
}
void TestGroup_Person::test_allFieldsEqualsFieldNames()
{
    const QVector<QString>& aVector = aGroup_Person->getDBTable_FieldNames();
    const QList<QString> aList = aGroup_Person->getAllFieldNames();
    bool isThere = true;
    QString fieldName = "";
    QString aResult = "This field name does not exist in all_FieldNamesAndValuesH";
    for (int i = 0; i < aVector.size() && isThere; ++i) {
        fieldName = aVector.at(i);
        isThere = aList.contains(aVector.at(i));
    }
    if (isThere)
        aResult = fieldName;
    QCOMPARE(fieldName, QString(aResult));
}
void TestGroup_Person::test_getDBTable_FieldNames()
{
    const QVector<QString>& aVector = aGroup_Person->getDBTable_FieldNames();
    QString fieldName = "";
    for (int i = 0; i < aVector.size(); ++i) {
        fieldName = fieldName + aVector.at(i) +",";
    }
    QVector<QString> fieldNames;
    QVector<QString> columnHeadings;
    aGroup_Person->getViewableFieldNamesAndHeadings(fieldNames, columnHeadings);
    bool correct = fieldNames.count() == columnHeadings.count();
    if (!correct)
        correct = columnHeadings.count() == 0;
    QCOMPARE(correct, true);
    QCOMPARE(fieldName,     QString("groupID,personID,jobID,grp_per_dateTimeStamp,"));
}
void TestGroup_Person::test_getDBTable_Name()
{
    QCOMPARE(aGroup_Person->getDBTable_Name(), QString("Group_Person"));
}
Relevant method of JB_DaoProt:
QSharedPointer<JB_TableRowProt> JB_DaoProt::getJoinTableObject()
{
    JB_TableRowProt* aJoinTable = new_JoinTableRowProt();
    QSharedPointer<JB_TableRowProt> pJoinTable(aJoinTable);
    return pJoinTable;
}