summaryrefslogtreecommitdiffstats
path: root/generic/tkGrid.c
diff options
context:
space:
mode:
authorculler <culler>2019-04-05 19:55:57 (GMT)
committerculler <culler>2019-04-05 19:55:57 (GMT)
commit081ca218bb45dcb50deb08f5674ed98c317f18b6 (patch)
treedc5c18612f61da4b945117828e40508bf3de2ae4 /generic/tkGrid.c
parentdb0089391e638dba6174fa80b2ab69a03cbce72b (diff)
downloadtk-081ca218bb45dcb50deb08f5674ed98c317f18b6.zip
tk-081ca218bb45dcb50deb08f5674ed98c317f18b6.tar.gz
tk-081ca218bb45dcb50deb08f5674ed98c317f18b6.tar.bz2
Fix bug [897ffea89f]: Tk allows management loops
Diffstat (limited to 'generic/tkGrid.c')
-rw-r--r--generic/tkGrid.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 20e66b6..5264b02 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -3352,17 +3352,23 @@ ConfigureSlaves(
}
/*
- * Try to make sure our master isn't managed by us.
+ * Check for management loops.
*/
- if (masterPtr->masterPtr == slavePtr) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ for (TkWindow *master = (TkWindow *)masterPtr->tkwin; master != NULL;
+ master = (TkWindow *)Tk_GetGeomMaster(master)) {
+ if (master == (TkWindow *)slave) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't put %s inside %s, would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
- Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
- Unlink(slavePtr);
- return TCL_ERROR;
- }
+ Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
+ Unlink(slavePtr);
+ return TCL_ERROR;
+ }
+ }
+ if (masterPtr->tkwin != Tk_Parent(slave)) {
+ ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin;
+ }
Tk_ManageGeometry(slave, &gridMgrType, slavePtr);