ResetWidgetValue resets the [Value] if it was already bound to another value previously. We first need to reset the widget value to zero to avoid any issues with the pointer from the old value persisting and being updated. For example, that issue happened with slice and map pointers persisting in fo
(vw Value)
| 81 | // It should not be called by end-user code; it must be exported since it is referenced |
| 82 | // in a generic function added to yaegi ([Bind]). |
| 83 | func ResetWidgetValue(vw Value) { |
| 84 | rv := reflect.ValueOf(vw.WidgetValue()) |
| 85 | if rv.IsValid() && rv.Type().Kind() == reflect.Pointer { |
| 86 | rv.Elem().SetZero() |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // joinValueTitle returns a [WidgetBase.ValueTitle] string composed |
| 91 | // of two elements, with a • separator, handling the cases where |