Commit ce71fb25 authored by Milian Wolff's avatar Milian Wolff
Browse files

Initialize the CodeModel item repository together with the DUChain

This way we can be sure it's fully initialized when we initialized
the DUChain and do not run into potential trouble with multiple
threads initializing it later on.
parent 90110fa9
......@@ -174,6 +174,11 @@ class ItemRepositoryFor<CodeModel>
static CodeModelRepo repo(QStringLiteral("Code Model"), &mutex);
return repo;
}
public:
static void init()
{
repo();
}
};
class CodeModelPrivate
......@@ -183,6 +188,7 @@ class CodeModelPrivate
CodeModel::CodeModel()
: d_ptr(nullptr)
{
ItemRepositoryFor<CodeModel>::init();
}
CodeModel::~CodeModel() = default;
......
......@@ -50,6 +50,7 @@
#include "serialization/itemrepository.h"
#include "waitforupdate.h"
#include "importers.h"
#include "codemodel.h"
#if HAVE_MALLOC_TRIM
#include "malloc.h"
......@@ -1296,6 +1297,7 @@ void DUChain::initialize()
initInstantiationInformationRepository();
Importers::self();
CodeModel::self();
globalImportIdentifier();
globalIndexedImportIdentifier();
......
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