From 96c7daa17f7db316419302c5bca7c3258c5a772b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 27 Dec 2015 11:26:37 +0100 Subject: Ensure the initialization of the TypeIndex is threadsafe. Multiple initial queries can be running at the same time. --- common/domain/mail.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'common/domain/mail.cpp') diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp index a698b6d..8875d88 100644 --- a/common/domain/mail.cpp +++ b/common/domain/mail.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "../resultset.h" #include "../index.h" @@ -33,10 +35,13 @@ #include "mail_generated.h" +static QMutex sMutex; + using namespace Akonadi2::ApplicationDomain; static TypeIndex &getIndex() { + QMutexLocker locker(&sMutex); static TypeIndex *index = 0; if (!index) { index = new TypeIndex("mail"); -- cgit v1.2.3