]> git.sesse.net Git - stockfish/commitdiff
Fix another crash triggered by previous patch
authorMarco Costalba <mcostalba@gmail.com>
Sun, 11 Dec 2011 10:42:16 +0000 (11:42 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 11 Dec 2011 10:44:09 +0000 (11:44 +0100)
It is ok to redirect st pointer to startState, but the latter
should be updated with the content pointed by the st of the
original position. The bug is hidden when startState and *st
are the same as is the case of searching from start position,
but as soon as moves are made (as is the case when splitting)
the bug leads to a crash.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.cpp

index bf8497cf90f79310f2a0f5e6a1c67cecbdd18cc9..66890a5f5e2224473d81f4a20d6ab3b8b0937814 100644 (file)
@@ -100,6 +100,7 @@ CheckInfo::CheckInfo(const Position& pos) {
 void Position::copy(const Position& pos, int th) {
 
   memcpy(this, &pos, sizeof(Position));
+  startState = *st;
   st = &startState;
   threadID = th;
   nodes = 0;