1
0
Fork 0

Disable GUI updates while running a script

This commit is contained in:
Duncan Ogilvie 2023-02-24 01:41:53 +01:00
parent 7f66d171d6
commit 4475065928
1 changed files with 7 additions and 0 deletions

View File

@ -520,6 +520,10 @@ static DWORD WINAPI scriptLoadSyncThread(LPVOID filename)
bool scriptRunSync(int destline, bool silentRet)
{
// disable GUI updates
auto guiUpdateWasDisabled = GuiIsUpdateDisabled();
if(!guiUpdateWasDisabled)
GuiUpdateDisable();
if(!destline || destline > (int)linemap.size()) //invalid line
destline = 0;
if(destline)
@ -556,6 +560,9 @@ bool scriptRunSync(int destline, bool silentRet)
}
}
bIsRunning = false; //not running anymore
// re-enable GUI updates when appropriate
if(!guiUpdateWasDisabled)
GuiUpdateEnable(true);
GuiScriptSetIp(scriptIp);
// the script fully executed (which means scriptIp is reset to the first line), without any errors
return scriptIp == scriptinternalstep(0) && (scriptLastError == STATUS_EXIT || scriptLastError == STATUS_CONTINUE);