Verified Commit 2800e2ba authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

DataStore: don't call close() in dtor, assert on user calling it

Otherwise we have to call a virtual function from the destructor, which
may have undesirable side-effects.

Found by clang-tidy
parent 12e609d1
......@@ -26,6 +26,7 @@
#include "storage/itemretrievaljob.h"
#include "storage/itemretrievalmanager.h"
#include "storage/itemretrievalrequest.h"
#include "storage/datastore.h"
#include "commandcontext.h"
#include "fakeakonadiserver.h"
......@@ -172,6 +173,8 @@ public:
if (m_results.signalsCount > 0) {
m_results.emittedItems = spy.at(0).at(0).value<QVector<qint64>>();
}
DataStore::self()->close();
}
struct Results
......
......@@ -51,6 +51,9 @@ public:
{
}
DefaultAttribute(const DefaultAttribute &) = delete;
DefaultAttribute &operator=(const DefaultAttribute &) = delete;
QByteArray type() const override
{
return mType;
......
......@@ -108,9 +108,7 @@ DataStore::DataStore(AkonadiServer &akonadi)
DataStore::~DataStore()
{
if (m_dbOpened) {
close();
}
Q_ASSERT_X(!m_dbOpened, "DataStore", "Attempting to destroy DataStore with opened DB connection. Call close() first!");
}
void DataStore::open()
......
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