Commit c1ead4ae authored by David Faure's avatar David Faure
Browse files

Port ExternalPartStorage::self to C++11 singleton syntax.

Much simpler, and fixes a strange asan error about sInstance violating
ODR because defined twice in the test binary (which didn't seem right to me).

Test Plan: externalpartstoragetest now passes in the ASAN build

Reviewers: dvratil, vkrause

Reviewed By: vkrause

Subscribers: kde-pim

Differential Revision:
parent c8627460
......@@ -28,8 +28,6 @@
using namespace Akonadi;
ExternalPartStorage *ExternalPartStorage::sInstance = nullptr;
......@@ -58,12 +56,8 @@ ExternalPartStorage::ExternalPartStorage()
ExternalPartStorage *ExternalPartStorage::self()
static QMutex instanceLock;
QMutexLocker locker(&instanceLock);
if (!sInstance) {
sInstance = new ExternalPartStorage();
return sInstance;
static ExternalPartStorage sInstance;
return &sInstance;
QString ExternalPartStorage::resolveAbsolutePath(const QByteArray &filename, bool *exists, bool legacyFallback)
......@@ -95,8 +95,6 @@ private:
bool replayTransaction(const QVector<Operation> &trx, bool commit);
void addToTransaction(const QVector<Operation> &ops);
static ExternalPartStorage *sInstance;
mutable QMutex mTransactionLock;
QHash<QThread *, QVector<Operation>> mTransactions;
Supports Markdown
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