summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-05-03 19:16:10 (GMT)
committerhobbs <hobbs>2004-05-03 19:16:10 (GMT)
commit656c3e9322cd07ef47c82de88d51080c09adab60 (patch)
tree3f1e840096ac0d77625039354876bfd635dadf5b
parent29f9a26ab63583f320e15f62cf93033cd448cffb (diff)
downloadtk-656c3e9322cd07ef47c82de88d51080c09adab60.zip
tk-656c3e9322cd07ef47c82de88d51080c09adab60.tar.gz
tk-656c3e9322cd07ef47c82de88d51080c09adab60.tar.bz2
* tests/panedwindow.test: panedwindow-25.1
* generic/tkPanedWindow.c (Unlink): clean up -before/-after refs to a slave when removing it. [Bug #928413] (griffin)
-rw-r--r--ChangeLog4
-rw-r--r--generic/tkPanedWindow.c14
-rw-r--r--tests/panedwindow.test33
3 files changed, 43 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 9813b2c..24830ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2004-05-03 Jeff Hobbs <jeffh@ActiveState.com>
+ * tests/panedwindow.test: panedwindow-25.1
+ * generic/tkPanedWindow.c (Unlink): clean up -before/-after refs
+ to a slave when removing it. [Bug #928413] (griffin)
+
* generic/tkImgPhoto.c (ImgPhotoConfigureMaster): force -data into
ByteArray and -format into String to correctly handle them if they
have been shimmered or created as some other object type.
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 80e2cb8..c154b48 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.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: tkPanedWindow.c,v 1.18 2003/09/29 23:15:19 dkf Exp $
+ * RCS: @(#) $Id: tkPanedWindow.c,v 1.19 2004/05/03 19:16:10 hobbs Exp $
*/
#include "tkPort.h"
@@ -1748,6 +1748,18 @@ Unlink(slavePtr)
}
}
+ /*
+ * Clean out any -after or -before references to this slave
+ */
+ for (i = 0; i < masterPtr->numSlaves; i++) {
+ if (masterPtr->slaves[i]->before == slavePtr->tkwin) {
+ masterPtr->slaves[i]->before = None;
+ }
+ if (masterPtr->slaves[i]->after == slavePtr->tkwin) {
+ masterPtr->slaves[i]->after = None;
+ }
+ }
+
masterPtr->flags |= REQUESTED_RELAYOUT;
if (!(masterPtr->flags & REDRAW_PENDING)) {
masterPtr->flags |= REDRAW_PENDING;
diff --git a/tests/panedwindow.test b/tests/panedwindow.test
index e345e2a..9be6aae 100644
--- a/tests/panedwindow.test
+++ b/tests/panedwindow.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: panedwindow.test,v 1.12 2003/07/18 10:02:03 dkf Exp $
+# RCS: @(#) $Id: panedwindow.test,v 1.13 2004/05/03 19:16:11 hobbs Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -2145,7 +2145,7 @@ test panedwindow-24.22 {ConfigurePanes, slave specified multiple times} {
destroy .p .a .b .c
set result
} {.a .b .c}
-test panedwindow-22.23 {ConfigurePanes, slave specified multiple times} {
+test panedwindow-24.23 {ConfigurePanes, slave specified multiple times} {
# This test should not cause a core dump
panedwindow .p
@@ -2159,14 +2159,14 @@ test panedwindow-22.23 {ConfigurePanes, slave specified multiple times} {
destroy .p .a .b .c
set result
} {.c .a .b}
-test panedwindow-22.24 {ConfigurePanes, panedwindow cannot manage toplevels} {
+test panedwindow-24.24 {ConfigurePanes, panedwindow cannot manage toplevels} {
panedwindow .p
toplevel .t
set result [list [catch {.p add .t} msg] $msg]
destroy .p .t
set result
} [list 1 "can't add toplevel .t to .p"]
-test panedwindow-22.25 {ConfigurePanes, restrict possible panes} {
+test panedwindow-24.25 {ConfigurePanes, restrict possible panes} {
panedwindow .p
frame .f
button .f.b
@@ -2174,7 +2174,7 @@ test panedwindow-22.25 {ConfigurePanes, restrict possible panes} {
destroy .p .f .f.b
set result
} [list 1 "can't add .f.b to .p"]
-test panedwindow-22.26 {ConfigurePanes, restrict possible panes} {
+test panedwindow-24.26 {ConfigurePanes, restrict possible panes} {
frame .f
panedwindow .f.p
button .b
@@ -2182,14 +2182,14 @@ test panedwindow-22.26 {ConfigurePanes, restrict possible panes} {
destroy .f.p .f .b
set result
} [list 0 ""]
-test panedwindow-22.27 {ConfigurePanes, restrict possible panes} {
+test panedwindow-24.27 {ConfigurePanes, restrict possible panes} {
panedwindow .p
button .p.b
set result [list [catch {.p add .p.b} msg] $msg]
destroy .p .p.b
set result
} [list 0 ""]
-test panedwindow-22.28 {ConfigurePanes, restrict possible panes} {
+test panedwindow-24.28 {ConfigurePanes, restrict possible panes} {
frame .f
frame .f.f
frame .f.f.f
@@ -2200,6 +2200,25 @@ test panedwindow-22.28 {ConfigurePanes, restrict possible panes} {
set result
} [list 0 ""]
+test panedwindow-25.1 {Unlink, remove a paned with -before/-after refs} {
+ # Bug 928413
+ set result {}
+ panedwindow .pw
+ label .pw.l1 -text Label1
+ label .pw.l2 -text Label2
+ label .pw.l3 -text Label3
+ .pw add .pw.l1
+ .pw add .pw.l3
+ .pw add .pw.l2 -before .pw.l3
+ lappend result [.pw panecget .pw.l2 -before]
+ destroy .pw.l3
+ lappend result [.pw panecget .pw.l2 -before]
+ .pw paneconfigure .pw.l2 -before .pw.l1
+ lappend result [.pw panecget .pw.l2 -before]
+ destroy .pw
+ set result
+} {.pw.l3 {} .pw.l1}
+
test panedwindow-26.1 {DestroyPanedWindow} {
# This test should not result in any memory leaks.
panedwindow .p