Fix MessageBox Avalanches due to Message blocking

This fixes #1320. The root cause for the avalanche of
messages is due to how the refresh timer system calls GenerateAll. When
GenerateAll is called by Refresh, if a Message occurs, that Message will
block GenerateAll. It _doesn't_ block subsequent calls from the timer to
Refresh (presumably from a separate thread). Because the
"scheduledGenerateAll" flag is not cleared until after the generation is
unblocked, each following refresh triggers another call to GenerateAll.
By reversing the flag clear and call, it breaks the cycle. I don't think
this matters for scheduledShowTW, but I updated it as well.
This commit is contained in:
Blockers 2023-01-20 21:36:25 -05:00 committed by Paul Kahler
parent 3c91bf7ca4
commit d6e970918f

View File

@ -305,12 +305,14 @@ void SolveSpaceUI::Exit() {
void SolveSpaceUI::Refresh() {
// generateAll must happen bfore updating displays
if(scheduledGenerateAll) {
GenerateAll(Generate::DIRTY, /*andFindFree=*/false, /*genForBBox=*/false);
// Clear the flag so that if the call to GenerateAll is blocked by a Message or Error,
// subsequent refreshes do not try to Generate again.
scheduledGenerateAll = false;
GenerateAll(Generate::DIRTY, /*andFindFree=*/false, /*genForBBox=*/false);
}
if(scheduledShowTW) {
TW.Show();
scheduledShowTW = false;
TW.Show();
}
}