summaryrefslogtreecommitdiffstats
path: root/generic/tkPlace.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/tkPlace.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/tkPlace.c')
-rw-r--r--generic/tkPlace.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 8eee5a1..89976b5 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -694,6 +694,25 @@ ConfigureSlave(
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
+
+ /*
+ * Check for management loops.
+ */
+
+ for (TkWindow *master = (TkWindow *)tkwin; master != NULL;
+ master = (TkWindow *)Tk_GetGeomMaster(master)) {
+ if (master == (TkWindow *)slavePtr->tkwin) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't put %s inside %s, would cause management loop",
+ Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin)));
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
+ goto error;
+ }
+ }
+ if (tkwin != Tk_Parent(slavePtr->tkwin)) {
+ ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin;
+ }
+
if ((slavePtr->masterPtr != NULL)
&& (slavePtr->masterPtr->tkwin == tkwin)) {
/*