From 0ccf537103d67e040cd85623635358855f1c99f6 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 28 Mar 2021 06:31:03 +0000 Subject: [PATCH] Fixed two minor issues in bx_param_num_c class. - reset() must call set() to ensure the set handler is called if present. - don't set value if parameter is disabled. --- bochs/gui/paramtree.cc | 2 ++ bochs/gui/paramtree.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bochs/gui/paramtree.cc b/bochs/gui/paramtree.cc index 0b1680b8b..364298933 100644 --- a/bochs/gui/paramtree.cc +++ b/bochs/gui/paramtree.cc @@ -231,6 +231,8 @@ Bit64s bx_param_num_c::get64() void bx_param_num_c::set(Bit64s newval) { + if (!enabled) return; + if (handler) { // the handler can override the new value and/or perform some side effect val.number = (*handler)(this, 1, newval); diff --git a/bochs/gui/paramtree.h b/bochs/gui/paramtree.h index b62c0143a..9e6c00303 100644 --- a/bochs/gui/paramtree.h +++ b/bochs/gui/paramtree.h @@ -211,7 +211,7 @@ public: const char *description, Bit64s min, Bit64s max, Bit64s initial_val, bool is_shadow = 0); - virtual void reset() { val.number = initial_val; } + virtual void reset() { set(initial_val); } void set_handler(param_event_handler handler); void set_sr_handlers(void *devptr, param_save_handler save, param_restore_handler restore); void set_enable_handler(param_enable_handler handler) { enable_handler = handler; }