forked from mirrors/0ad
Don't use std::shared_ptr to store m_ScriptContext and m_ScriptInterface in the CGUIManager
`std::shared_ptr` is intrusive. When a function expects a `std::shared_ptr` the caller has to use it too and can't store the element on the stack for example. Comments by: @vladislavbelov Differential Revision: https://code.wildfiregames.com/D5221 This was SVN commit r28131.
This commit is contained in:
+5
-1
@@ -678,9 +678,12 @@ static void RunGameOrAtlas(const PS::span<const char* const> argv)
|
||||
g_Mods.UpdateAvailableMods(modInterface);
|
||||
}
|
||||
|
||||
std::optional<ScriptInterface> guiScriptInterface;
|
||||
|
||||
if (isVisual)
|
||||
{
|
||||
InitGraphics(args, 0, installedMods);
|
||||
guiScriptInterface.emplace("Engine", "gui", *g_ScriptContext);
|
||||
InitGraphics(args, 0, installedMods, *g_ScriptContext, *guiScriptInterface);
|
||||
MainControllerInit();
|
||||
}
|
||||
else if (!InitNonVisual(args))
|
||||
@@ -709,6 +712,7 @@ static void RunGameOrAtlas(const PS::span<const char* const> argv)
|
||||
modsToInstall.clear();
|
||||
|
||||
ShutdownNetworkAndUI();
|
||||
guiScriptInterface.reset();
|
||||
ShutdownConfigAndSubsequent();
|
||||
MainControllerShutdown();
|
||||
flags &= ~INIT_MODS;
|
||||
|
||||
Reference in New Issue
Block a user