Merge branch 'main' into beta

This commit is contained in:
David Capello 2022-04-06 00:00:44 -03:00
commit ab2cef1c29
4 changed files with 21 additions and 5 deletions

View File

@ -543,8 +543,16 @@ App::~App()
ASSERT(m_instance == this);
#ifdef ENABLE_SCRIPTING
// Destroy scripting engine
m_engine.reset(nullptr);
// Destroy scripting engine calling a method (instead of using
// reset()) because we need to keep the "m_engine" pointer valid
// until the very end, just in case that some Lua error happens
// now and we have to print that error using
// App::instance()->scriptEngine() in some way. E.g. if a Dialog
// onclose event handler fails with a Lua error when we are
// closing the app, a Lua error must be printed, and we need a
// valid m_engine pointer.
m_engine->destroy();
m_engine.reset();
#endif
// Delete file formats.

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -450,11 +450,17 @@ Engine::Engine()
}
Engine::~Engine()
{
ASSERT(L == nullptr);
}
void Engine::destroy()
{
#ifdef ENABLE_UI
close_all_dialogs();
#endif
lua_close(L);
L = nullptr;
}
void Engine::printLastResult()

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -83,6 +83,8 @@ namespace app {
Engine();
~Engine();
void destroy();
EngineDelegate* delegate() { return m_delegate; }
void setDelegate(EngineDelegate* delegate) {
m_delegate = delegate;

2
third_party/json11 vendored

@ -1 +1 @@
Subproject commit ec4e45219af1d7cde3d58b49ed762376fccf1ace
Subproject commit 3f1bd2b9e0b75aed13be7ca61b6958a07b9e453c