diff options
-rw-r--r-- | generic/ttk/ttkEntry.c | 8 | ||||
-rw-r--r-- | tests/ttk/entry.test | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 4862e99..352c53a 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -650,8 +650,12 @@ static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason) static void EntryRevalidateBG(Entry *entryPtr, VREASON reason) { Tcl_Interp *interp = entryPtr->core.interp; - if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) { - Tcl_BackgroundException(interp, TCL_ERROR); + VMODE vmode = entryPtr->entry.validate; + + if (EntryNeedsValidation(vmode, reason)) { + if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) { + Tcl_BackgroundException(interp, TCL_ERROR); + } } } diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 34795fe..8b5f490 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -312,4 +312,16 @@ test entry-9.1 "Index range invariants" -setup { destroy .e } +test entry-10.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup { + pack [ttk::entry .e] + update +} -body { + .e state invalid + set res [.e state] + event generate .e <FocusOut> + lappend res [.e state] +} -result {invalid invalid} -cleanup { + destroy .e +} + tcltest::cleanupTests |