X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.cpp;h=b7bead9ff0c867627105cb0eb8ee9ffa328c733e;hp=71b9ce0c091412e6424791c1e38bd4553fc04f7c;hb=db4cd89cb889446fb349d0d93640b640b1b9a8a1;hpb=8ceef922662c75c33d105d99732475c125b01081 diff --git a/src/thread.cpp b/src/thread.cpp index 71b9ce0c..b7bead9f 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -366,12 +366,16 @@ void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits, Signals.stopOnPonderhit = Signals.firstRootMove = false; Signals.stop = Signals.failedLowAtRoot = false; + RootMoves.clear(); RootPos = pos; Limits = limits; - SetupStates = states; // Ownership transfer here - RootMoves.clear(); + if (states.get()) // If we don't set a new position, preserve current state + { + SetupStates = states; // Ownership transfer here + assert(!states.get()); + } - for (MoveList it(pos); !it.end(); ++it) + for (MoveList it(pos); *it; ++it) if ( searchMoves.empty() || std::count(searchMoves.begin(), searchMoves.end(), *it)) RootMoves.push_back(RootMove(*it));