mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 18:46:59 +08:00
Fix UCI 'button' options
When a button fires UCIOption::operator=() is called and from
there the on_change() function. Now it happens that in case of
a button the on_change() function resets option's value to
"false" triggering again UCIOption::operator=() that calls again
on_change() and so on in an endless loop that is experienced
by the user as an application hang.
Rework the button logic to fix the issue and also be more clear
about how button works.
Reported by several people working with Scid and tracked down
to the "Clear Hash" UCI button by Steven Atkinson.
Bug recently introduced by 2ef5b4066e.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -30,12 +30,12 @@ struct OptionsMap;
|
||||
/// UCIOption class implements an option as defined by UCI protocol
|
||||
class UCIOption {
|
||||
|
||||
typedef void (Fn)(UCIOption&);
|
||||
typedef void (Fn)(const UCIOption&);
|
||||
|
||||
public:
|
||||
UCIOption() {} // Required by std::map::operator[]
|
||||
UCIOption(const char* v, Fn* = NULL);
|
||||
UCIOption(Fn* = NULL);
|
||||
UCIOption(bool v, Fn* = NULL);
|
||||
UCIOption(const char* v, Fn* = NULL);
|
||||
UCIOption(int v, int min, int max, Fn* = NULL);
|
||||
|
||||
void operator=(const std::string& v);
|
||||
|
||||
Reference in New Issue
Block a user