From e51b469b07e385f8d952e1e83fbbb98be5a71a79 Mon Sep 17 00:00:00 2001 From: uid38226 Date: Thu, 31 Jan 2002 21:05:27 +0000 Subject: Correct and test for logic error when cloning menus. Bug 508988 --- ChangeLog | 5 +++++ generic/tkMenu.c | 4 ++-- tests/menu.test | 21 ++++++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 13c3646..7462427 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-01-31 Todd Helfter + * generic/tkMenu.c (ConfigureMenuCloneEntries) + * tests/menu.test (menu3.68) + Correct and test for logic error when cloning menus. [Bug 508988] + 2002-01-30 Don Porter * generic/tk.decls: The POTENTIAL INCOMPATIBILITY in the changing diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 773b1e2..070c553 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMenu.c,v 1.15 2002/01/25 21:09:37 dgp Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.16 2002/01/31 21:05:27 uid38226 Exp $ */ /* @@ -1998,7 +1998,7 @@ ConfigureMenuCloneEntries(interp, menuPtr, index, objc, objv) oldCascadeName = Tcl_GetStringFromObj(oldCascadePtr, NULL); cascadeEntryChanged = (strcmp(oldCascadeName, newCascadeName) - == 0); + != 0); } if (oldCascadePtr != NULL) { Tcl_DecrRefCount(oldCascadePtr); diff --git a/tests/menu.test b/tests/menu.test index 0699e7b..701a3af 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: menu.test,v 1.10 2001/11/17 22:35:50 hobbs Exp $ +# RCS: @(#) $Id: menu.test,v 1.11 2002/01/31 21:05:27 uid38226 Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -913,6 +913,25 @@ test menu-3.67 {MenuWidgetCmd procedure, bad option} { menu .m1 list [catch {.m1 foo} msg] $msg [destroy .m1] } {1 {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, or yposition} {}} +test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} { + set t .t + set m1 .t.m1 + set c1 .t.c1 + set c2 .t.c2 + toplevel .t + menu $m1 -tearoff 1 + menu $c1 -tearoff 1 + $c1 add command -label c1 + menu $c2 -tearoff 1 + $c2 add command -label c2 + $m1 add cascade -label c1 -menu $c1 + $t configure -menu $m1 + $m1 entryconfigure 1 -menu $c2 -label c2 + $t configure -menu "" + set l [list [winfo exists $c1] [winfo exists $c2]] + destroy $t; + set l; +} {1 1} test menu-4.1 {TkInvokeMenu: disabled} { catch {destroy .m1} -- cgit v0.12