Solve potential add-on install race condition

This commit is contained in:
Jack Andersen 2016-08-24 14:27:53 -10:00
parent 4795565dd9
commit 8c8a143f6b
3 changed files with 14 additions and 5 deletions

View File

@ -190,6 +190,8 @@ void BlenderConnection::_blenderDied()
BlenderLog.report(logvisor::Fatal, "Blender Exception");
}
static std::atomic_bool BlenderFirstInit(false);
BlenderConnection::BlenderConnection(int verbosityLevel)
{
BlenderLog.report(logvisor::Info, "Establishing BlenderConnection...");
@ -207,16 +209,21 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
TMPDIR = (char*)"/tmp";
m_startupBlend = TMPDIR;
#endif
hecl::SystemString blenderShellPath(TMPDIR);
blenderShellPath += _S("/hecl_blendershell.py");
InstallBlendershell(blenderShellPath.c_str());
hecl::SystemString blenderAddonPath(TMPDIR);
blenderAddonPath += _S("/hecl_blenderaddon.zip");
InstallAddon(blenderAddonPath.c_str());
m_startupBlend += "/hecl_startup.blend";
InstallStartup(m_startupBlend.c_str());
bool FalseCmp = false;
if (BlenderFirstInit.compare_exchange_strong(FalseCmp, true))
{
InstallBlendershell(blenderShellPath.c_str());
InstallAddon(blenderAddonPath.c_str());
InstallStartup(m_startupBlend.c_str());
}
int installAttempt = 0;
while (true)

View File

@ -231,6 +231,8 @@ static hecl::SystemString MakePathArgAbsolute(const hecl::SystemString& arg,
void ToolPrintProgress(const hecl::SystemChar* message, const hecl::SystemChar* submessage,
int lidx, float factor, int& lineIdx)
{
auto lk = logvisor::LockLog();
bool blocks = factor >= 0.0;
factor = std::max(0.0f, std::min(1.0f, factor));
int iFactor = factor * 100.0;

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit e92e6d7c4c13f4033ae5f0f09018573235e2212e
Subproject commit e45c3feef6e42d5720259e4a6eb830d815ab1dfe