diff options
author | culler <culler> | 2019-04-05 19:55:57 (GMT) |
---|---|---|
committer | culler <culler> | 2019-04-05 19:55:57 (GMT) |
commit | 081ca218bb45dcb50deb08f5674ed98c317f18b6 (patch) | |
tree | dc5c18612f61da4b945117828e40508bf3de2ae4 /generic/tkGrid.c | |
parent | db0089391e638dba6174fa80b2ab69a03cbce72b (diff) | |
download | tk-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.c | 22 |
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); |