From: H.G.Muller Date: Thu, 5 Jan 2017 21:30:41 +0000 (+0100) Subject: Use feature timeout when starting second engine for analysis X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=6a7b0bcfb46092809ac826bf99652b9bce5d9a10 Use feature timeout when starting second engine for analysis When the second engine gets ivolved in the analysis, but has not been used before, so that its features are unknown, we now wait for these features (or time out in case of v1 engines) before initializing the engine. Without this 'edit' could be used on engines that need 'setboard', or false 'unsupported variant' errors could arise. --- diff --git a/backend.c b/backend.c index 29b473b..4f1aad8 100644 --- a/backend.c +++ b/backend.c @@ -14784,18 +14784,25 @@ EditTagsEvent () } void -ToggleSecond () +StartSecond () { - if(second.analyzing) { - SendToProgram("exit\n", &second); - second.analyzing = FALSE; - } else { - if (second.pr == NoProc) StartChessProgram(&second); + if(WaitForEngine(&second, StartSecond)) return; InitChessProgram(&second, FALSE); FeedMovesToProgram(&second, currentMove); SendToProgram("analyze\n", &second); second.analyzing = TRUE; + ThawUI(); +} + +void +ToggleSecond () +{ + if(second.analyzing) { + SendToProgram("exit\n", &second); + second.analyzing = FALSE; + } else { + StartSecond(); } } @@ -17398,7 +17405,7 @@ FeatureDone (ChessProgramState *cps, int val) DelayedEventCallback cb = GetDelayedEvent(); if ((cb == InitBackEnd3 && cps == &first) || (cb == SettingsMenuIfReady && cps == &second) || - (cb == LoadEngine) || + (cb == LoadEngine) || (cb == StartSecond) || (cb == TwoMachinesEventIfReady)) { CancelDelayedEvent(); ScheduleDelayedEvent(cb, val ? 1 : 3600000);