From 15bcbc130e6c0ff912723583f82b966fadb1629a 2017-06-19 08:41:49 From: Alexandre Leroux Date: 2017-06-19 08:41:49 Subject: [PATCH] Use raw pointer for VariableModel (QObject class) --- diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index ce36585..8c05bd9 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -7,17 +7,18 @@ Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") struct VariableController::VariableControllerPrivate { - explicit VariableControllerPrivate() - : m_WorkingMutex{}, m_VariableModel{std::make_unique()} + explicit VariableControllerPrivate(VariableController *parent) + : m_WorkingMutex{}, m_VariableModel{new VariableModel{parent}} { } QMutex m_WorkingMutex; - std::unique_ptr m_VariableModel; + /// Variable model. The VariableController has the ownership + VariableModel *m_VariableModel; }; VariableController::VariableController(QObject *parent) - : QObject{parent}, impl{spimpl::make_unique_impl()} + : QObject{parent}, impl{spimpl::make_unique_impl(this)} { qCDebug(LOG_VariableController()) << tr("VariableController construction") << QThread::currentThread(); @@ -37,7 +38,7 @@ Variable *VariableController::createVariable(const QString &name) noexcept VariableModel *VariableController::variableModel() noexcept { - return impl->m_VariableModel.get(); + return impl->m_VariableModel; } void VariableController::initialize()