forked from qt-creator/qt-creator
Lua: Bind lifetime of LuaEngine
We want to make sure that the LuaEngine is deleted when the plugin is removed. We also derive LuaEngine from QObject so we can use it as a guard in QObject::connect calls. Change-Id: I6b0568f11bee283f880ede9432b2a9fe83014758 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "luaengine.h"
|
||||
#include "luapluginloader.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -34,8 +35,13 @@ class LuaPlugin : public ExtensionSystem::IPlugin
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Lua.json")
|
||||
|
||||
private:
|
||||
std::unique_ptr<LuaEngine> m_luaEngine;
|
||||
|
||||
public:
|
||||
LuaPlugin() = default;
|
||||
LuaPlugin()
|
||||
: m_luaEngine(new LuaEngine())
|
||||
{}
|
||||
~LuaPlugin() override = default;
|
||||
|
||||
void initialize() final
|
||||
|
Reference in New Issue
Block a user