summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanton <stanton@noemail.net>1999-01-06 21:10:45 (GMT)
committerstanton <stanton@noemail.net>1999-01-06 21:10:45 (GMT)
commit2f8dc5c5df5a36b6738cbc400429373023afdd45 (patch)
treef3b0b77980dea9353ef24843caa0eacb634e1ffb
parentd8e58295265b00d0a5a97a730d1d9e36ac941588 (diff)
downloadtk-2f8dc5c5df5a36b6738cbc400429373023afdd45.zip
tk-2f8dc5c5df5a36b6738cbc400429373023afdd45.tar.gz
tk-2f8dc5c5df5a36b6738cbc400429373023afdd45.tar.bz2
* generic/tkGrid.c: Fixed bug in "grid forget" that failed to cancelscriptics-tclpro-1-2-b1
pending idle handlers, resulting in a crash in a few odd cases. FossilOrigin-Name: 065f580bc09c06aa780f311e4fdbbff497b1282b
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkGrid.c5
-rw-r--r--tests/grid.test47
3 files changed, 37 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d4500d..77c2329 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1998-12-30 <stanton@GASPODE>
+
+ * generic/tkGrid.c: Fixed bug in "grid forget" that failed to cancel
+ pending idle handlers, resulting in a crash in a few odd cases.
+
1998-11-24 <stanton@GASPODE>
* unix/tkUnixFont.c (TkpGetNativeFont): On some X servers,
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 46aa699..ea7a54c 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGrid.c,v 1.2 1998/09/14 18:23:12 stanton Exp $
+ * RCS: @(#) $Id: tkGrid.c,v 1.3 1999/01/06 21:10:46 stanton Exp $
*/
#include "tkInt.h"
@@ -440,6 +440,9 @@ Tk_GridCmd(clientData, interp, argc, argv)
slavePtr->padX = slavePtr->padY = 0;
slavePtr->iPadX = slavePtr->iPadY = 0;
slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
+ if (slavePtr->flags & REQUESTED_RELAYOUT) {
+ Tk_CancelIdleCall(ArrangeGrid, (ClientData) slavePtr);
+ }
slavePtr->flags = 0;
slavePtr->sticky = 0;
}
diff --git a/tests/grid.test b/tests/grid.test
index 61cc661..85464d7 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -2,29 +2,16 @@
# of Tk. It is (almost) organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1996 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: grid.test,v 1.2 1998/09/14 18:23:47 stanton Exp $
+# RCS: @(#) $Id: grid.test,v 1.3 1999/01/06 21:10:46 stanton Exp $
if {[string compare test [info procs test]] == 1} then \
{source ../tests/defs}
-# Test Arguments:
-# name - Name of test, in the form foo-1.2.
-# description - Short textual description of the test, to
-# help humans understand what it does.
-# constraints - A list of one or more keywords, each of
-# which must be the name of an element in
-# the array "testConfig". If any of these
-# elements is zero, the test is skipped.
-# This argument may be omitted.
-# script - Script to run to carry out the test. It must
-# return a result that can be checked for
-# correctness.
-# answer - Expected result from script.
-
# helper routine to return "." to a sane state after a test
# The variable GRID_VERBOSE can be used to "look" at the result
# of one or all of the tests
@@ -310,18 +297,18 @@ test grid-6.7 {location (y)} {
grid_reset 6.7
test grid-6.8 {location (weights)} {
- frame .f -width 200 -height 100 -highlightthickness 0 -bg red
+ frame .f -width 300 -height 100 -highlightthickness 0 -bg red
frame .a
grid .a
grid .f -in .a
grid rowconfigure .f 0 -weight 1
grid columnconfigure .f 0 -weight 1
grid propagate .a 0
- .a configure -width 110 -height 15
+ .a configure -width 200 -height 15
update
set got ""
set result ""
- for {set y -10} { $y < 120} { incr y} {
+ for {set y -10} { $y < 210} { incr y} {
set a [grid location . $y $y]
if {$a != $got} {
lappend result $y->$a
@@ -329,7 +316,7 @@ test grid-6.8 {location (weights)} {
}
}
set result
-} {{-10->-1 -1} {0->0 0} {16->0 1} {111->1 1}}
+} {{-10->-1 -1} {0->0 0} {16->0 1} {201->1 1}}
grid_reset 6.8
test grid-6.9 {location: check updates pending} {
@@ -1203,3 +1190,25 @@ test grid-16.8 {layout internal constraints} {
}
set a
} {0 30 70 250 280 , 0 30 130 230 260 , 0 30 113 197 280 , 0 30 60 90 120 }
+
+test grid-17.1 {forget and pending idle handlers} {
+ # This test is intended to detect a crash caused by a failure to remove
+ # pending idle handlers when grid forget is invoked.
+
+ toplevel .t
+ frame .t.f
+ label .t.f.l -text foobar
+ grid .t.f.l
+ grid .t.f
+ update
+ grid forget .t.f.l
+ grid forget .t.f
+ destroy .t
+
+ toplevel .t
+ frame .t.f
+ label .t.f.l -text foobar
+ grid .t.f.l
+ destroy .t
+ set result ok
+} ok