X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=dceaa5a4bc331d2240f98269c7e037f524888826;hp=abac6efc1ef56e4b57a22734558c5d1c3564348a;hb=268c12bf31f347d7cc9e9b5b8d5fc0bbcc445bc5;hpb=9f943a132a2290f28eea388bf5ea45ddab7da973 diff --git a/src/position.cpp b/src/position.cpp index abac6efc..dceaa5a4 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -52,6 +52,7 @@ Key Position::zobSideToMove; Value Position::MgPieceSquareTable[16][64]; Value Position::EgPieceSquareTable[16][64]; +static bool RequestPending = false; //// //// Functions @@ -272,6 +273,13 @@ void Position::print(Move m) const { static const std::string pieceLetters = " PNBRQK PNBRQK ."; + // Check for reentrancy, as example when called from inside + // MovePicker that is used also here in move_to_san() + if (RequestPending) + return; + + RequestPending = true; + std::cout << std::endl; if (m != MOVE_NONE) { @@ -296,6 +304,8 @@ void Position::print(Move m) const { std::cout << "+---+---+---+---+---+---+---+---+" << std::endl << "Fen is: " << to_fen() << std::endl << "Key is: " << key << std::endl; + + RequestPending = false; }