forked from qt-creator/qt-creator
Lua: Don't destroy lua state too early
The Lua state needs to stay alive as long as any references to it may be alive. Therefore this patch leaves the destruction to the end. Fixes: QTCREATORBUG-31087 Change-Id: Ic49723575f7d2fe474cba9546845b65d57d7dcd0 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -51,7 +51,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
using PackageProvider = std::function<sol::object(sol::state_view)>;
|
using PackageProvider = std::function<sol::object(sol::state_view)>;
|
||||||
|
|
||||||
~LuaEngine();
|
~LuaEngine() override;
|
||||||
static LuaEngine &instance();
|
static LuaEngine &instance();
|
||||||
|
|
||||||
Utils::expected_str<LuaPluginSpec *> loadPlugin(const Utils::FilePath &path);
|
Utils::expected_str<LuaPluginSpec *> loadPlugin(const Utils::FilePath &path);
|
||||||
|
@@ -144,14 +144,11 @@ bool LuaPluginSpec::delayedInitialize()
|
|||||||
}
|
}
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag LuaPluginSpec::stop()
|
ExtensionSystem::IPlugin::ShutdownFlag LuaPluginSpec::stop()
|
||||||
{
|
{
|
||||||
d->activeLuaState.reset();
|
d->activeLuaState->stack_clear();
|
||||||
return ExtensionSystem::IPlugin::ShutdownFlag::SynchronousShutdown;
|
return ExtensionSystem::IPlugin::ShutdownFlag::SynchronousShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaPluginSpec::kill()
|
void LuaPluginSpec::kill() {}
|
||||||
{
|
|
||||||
d->activeLuaState.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LuaPluginSpec::printToOutputPane() const
|
bool LuaPluginSpec::printToOutputPane() const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user