From 06fadab9e665084e4cf25db7685025e33b4384bb Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 2 Jan 2020 14:55:52 +0000 Subject: Fix [2830360fff]: ttk::entry looses state invalid at focus events --- generic/ttk/ttkEntry.c | 8 ++++++-- 1 file changed, 6 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); + } } } -- cgit v0.12 From cfaf3bb262bde15d44e1fe6b640cce1eb165d891 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 2 Jan 2020 15:12:50 +0000 Subject: Add non-regression test entry-10.1 --- tests/ttk/entry.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 + lappend res [.e state] +} -result {invalid invalid} -cleanup { + destroy .e +} + tcltest::cleanupTests -- cgit v0.12