diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-09 21:21:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-09 21:21:16 (GMT) |
commit | ab7f6371560f592b332b846cd98187d290e9acec (patch) | |
tree | 6c0d9335d6b1624e3e9c23a9464c569dda2411b8 /generic | |
parent | 889aa68bcf4598cb57ab7de52e8d1b5e0bc72d55 (diff) | |
parent | de843496785dcba938fcaeda809956364801eefa (diff) | |
download | tk-ab7f6371560f592b332b846cd98187d290e9acec.zip tk-ab7f6371560f592b332b846cd98187d290e9acec.tar.gz tk-ab7f6371560f592b332b846cd98187d290e9acec.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkGrid.c | 82 | ||||
-rw-r--r-- | generic/tkPack.c | 64 |
2 files changed, 109 insertions, 37 deletions
diff --git a/generic/tkGrid.c b/generic/tkGrid.c index c4ebef6..7890b03 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -458,7 +458,9 @@ GridAnchorCommand( if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - containerPtr = GetGrid(container); + if (!(containerPtr = GetGrid(container))) { + return TCL_OK; + } if (objc == 3) { gridPtr = containerPtr->containerDataPtr; @@ -531,7 +533,9 @@ GridBboxCommand( if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - containerPtr = GetGrid(container); + if (!(containerPtr = GetGrid(container))) { + return TCL_OK; + } if (objc >= 5) { if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) { @@ -655,7 +659,9 @@ GridForgetRemoveCommand( return TCL_ERROR; } - contentPtr = GetGrid(content); + if (!(contentPtr = GetGrid(content))) { + continue; + } if (contentPtr->containerPtr != NULL) { /* * For "forget", reset all the settings to their defaults @@ -745,7 +751,9 @@ GridInfoCommand( if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) { return TCL_ERROR; } - contentPtr = GetGrid(content); + if (!(contentPtr = GetGrid(content))) { + return TCL_OK; + } if (contentPtr->containerPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; @@ -820,7 +828,9 @@ GridLocationCommand( return TCL_ERROR; } - containerPtr = GetGrid(container); + if (!(containerPtr = GetGrid(container))) { + return TCL_OK; + } if (containerPtr->containerDataPtr == NULL) { Tcl_SetObjResult(interp, NewPairObj(-1, TCL_INDEX_NONE)); return TCL_OK; @@ -901,7 +911,9 @@ GridPropagateCommand( if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - containerPtr = GetGrid(container); + if (!(containerPtr = GetGrid(container))) { + return TCL_OK; + } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE))); @@ -1023,7 +1035,9 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } - containerPtr = GetGrid(container); + if (!(containerPtr = GetGrid(container))) { + return TCL_OK; + } first = 0; last = 0; @@ -1139,7 +1153,9 @@ GridRowColumnConfigureCommand( * Is it gridded in this container? */ - contentPtr = GetGrid(content); + if (!(contentPtr = GetGrid(content))) { + continue; + } if (contentPtr->containerPtr != containerPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the window \"%s\" is not managed by \"%s\"", @@ -1322,7 +1338,9 @@ GridSizeCommand( if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - containerPtr = GetGrid(container); + if (!(containerPtr = GetGrid(container))) { + return TCL_OK; + } if (containerPtr->containerDataPtr != NULL) { SetGridSize(containerPtr); @@ -1401,7 +1419,9 @@ GridContentCommand( if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - containerPtr = GetGrid(container); + if (!(containerPtr = GetGrid(container))) { + return TCL_OK; + } res = Tcl_NewListObj(0, NULL); for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; @@ -2417,11 +2437,12 @@ ResolveConstraints( * GetGrid -- * * This internal procedure is used to locate a Grid structure for a given - * window, creating one if one doesn't exist already. + * window, creating one if one doesn't exist already, except if the window + * is already dead. * * Results: * The return value is a pointer to the Grid structure corresponding to - * tkwin. + * tkwin, or NULL when tkwin is already dead. * * Side effects: * A new grid structure may be created. If so, then a callback is set up @@ -2440,6 +2461,10 @@ GetGrid( int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + if (((TkWindow *) tkwin)->flags & TK_ALREADY_DEAD) { + return NULL; + } + if (!dispPtr->gridInit) { Tcl_InitHashTable(&dispPtr->gridHashTable, TCL_ONE_WORD_KEYS); dispPtr->gridInit = 1; @@ -2479,7 +2504,6 @@ GetGrid( gridPtr->sticky = 0; gridPtr->size = 0; gridPtr->in = NULL; - gridPtr->containerDataPtr = NULL; Tcl_SetHashValue(hPtr, gridPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, GridStructureProc, gridPtr); @@ -3012,11 +3036,15 @@ ConfigureContent( * If the stored container does not exist, just ignore it. */ - contentPtr = GetGrid(content); + if (!(contentPtr = GetGrid(content))) { + continue; + } if (contentPtr->in != NULL) { if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent) == TCL_OK) { - containerPtr = GetGrid(parent); + if (!(containerPtr = GetGrid(parent))) { + continue; + } InitContainerData(containerPtr); } } @@ -3024,7 +3052,9 @@ ConfigureContent( if (containerPtr == NULL) { parent = Tk_Parent(content); if (parent != NULL) { - containerPtr = GetGrid(parent); + if (!(containerPtr = GetGrid(parent))) { + continue; + } InitContainerData(containerPtr); } } @@ -3093,7 +3123,9 @@ ConfigureContent( TCL_OK) { return TCL_ERROR; } - containerPtr = GetGrid(other); + if (!(containerPtr = GetGrid(other))) { + continue; + } InitContainerData(containerPtr); } else if (index == CONF_ROW) { if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK @@ -3170,7 +3202,9 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL); return TCL_ERROR; } - contentPtr = GetGrid(content); + if (!(contentPtr = GetGrid(content))) { + continue; + } /* * The following statement is taken from tkPack.c: @@ -3229,7 +3263,9 @@ ConfigureContent( return TCL_ERROR; } positionGiven = 1; - containerPtr = GetGrid(other); + if (!(containerPtr = GetGrid(other))) { + continue; + } InitContainerData(containerPtr); break; case CONF_STICKY: { @@ -3336,7 +3372,9 @@ ConfigureContent( parent = Tk_Parent(content); if (containerPtr == NULL) { - containerPtr = GetGrid(parent); + if (!(containerPtr = GetGrid(parent))) { + continue; + } InitContainerData(containerPtr); } @@ -3495,7 +3533,9 @@ ConfigureContent( lastColumn = 0; } else { other = Tk_NameToWindow(interp, lastWindow, tkwin); - otherPtr = GetGrid(other); + if (!(otherPtr = GetGrid(other))) { + continue; + } lastRow = otherPtr->row + otherPtr->numRows - 2; lastColumn = otherPtr->column + otherPtr->numCols; } diff --git a/generic/tkPack.c b/generic/tkPack.c index 65962bf..8ca341a 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -247,7 +247,9 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { return TCL_ERROR; } - prevPtr = GetPacker(tkwin2); + if (!(prevPtr = GetPacker(tkwin2))) { + return TCL_OK; + } if (prevPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); @@ -264,7 +266,9 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { return TCL_ERROR; } - containerPtr = GetPacker(tkwin2); + if (!(containerPtr = GetPacker(tkwin2))) { + return TCL_OK; + } prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { @@ -281,7 +285,9 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { return TCL_ERROR; } - packPtr = GetPacker(tkwin2); + if (!(packPtr = GetPacker(tkwin2))) { + return TCL_OK; + } if (packPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); @@ -322,7 +328,9 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { continue; } - contentPtr = GetPacker(content); + if (!(contentPtr = GetPacker(content))) { + continue; + } if ((contentPtr != NULL) && (contentPtr->containerPtr != NULL)) { Tk_ManageGeometry(content, NULL, NULL); if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { @@ -347,7 +355,9 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) { return TCL_ERROR; } - contentPtr = GetPacker(content); + if (!(contentPtr = GetPacker(content))) { + return TCL_OK; + } if (contentPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); @@ -401,7 +411,9 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - containerPtr = GetPacker(container); + if (!(containerPtr = GetPacker(container))) { + return TCL_OK; + } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE))); @@ -458,7 +470,9 @@ Tk_PackObjCmd( return TCL_ERROR; } resultObj = Tcl_NewObj(); - containerPtr = GetPacker(container); + if (!(containerPtr = GetPacker(container))) { + return TCL_OK; + } for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, @@ -480,7 +494,7 @@ Tk_PackObjCmd( return TCL_ERROR; } packPtr = GetPacker(tkwin2); - if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) { + if (!packPtr && (packPtr->containerPtr != NULL)) { Tk_ManageGeometry(tkwin2, NULL, NULL); if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) { Tk_UnmaintainGeometry(packPtr->tkwin, @@ -1020,11 +1034,12 @@ YExpansion( * GetPacker -- * * This internal function is used to locate a Packer structure for a - * given window, creating one if one doesn't exist already. + * window, creating one if one doesn't exist already, except if the window + * is already dead. * * Results: * The return value is a pointer to the Packer structure corresponding to - * tkwin. + * tkwin, or NULL when tkwin is already dead. * * Side effects: * A new packer structure may be created. If so, then a callback is set @@ -1043,6 +1058,10 @@ GetPacker( int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + if (((TkWindow *) tkwin)->flags & TK_ALREADY_DEAD) { + return NULL; + } + if (!dispPtr->packInit) { dispPtr->packInit = 1; Tcl_InitHashTable(&dispPtr->packerHashTable, TCL_ONE_WORD_KEYS); @@ -1160,7 +1179,9 @@ PackAfter( if (tkwin == containerPtr->tkwin) { goto badWindow; } - packPtr = GetPacker(tkwin); + if (!(packPtr = GetPacker(tkwin))) { + return TCL_OK; + } /* * Process options for this window. @@ -1589,7 +1610,10 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL); return TCL_ERROR; } - contentPtr = GetPacker(content); + if (!(contentPtr = GetPacker(content))) { + continue; + } + contentPtr->flags &= ~OLD_STYLE; /* @@ -1627,7 +1651,9 @@ ConfigureContent( != TCL_OK) { return TCL_ERROR; } - prevPtr = GetPacker(other); + if (!(prevPtr = GetPacker(other))) { + continue; + } if (prevPtr->containerPtr == NULL) { notPacked: Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -1653,7 +1679,9 @@ ConfigureContent( != TCL_OK) { return TCL_ERROR; } - otherPtr = GetPacker(other); + if (!(otherPtr = GetPacker(other))) { + continue; + } if (otherPtr->containerPtr == NULL) { goto notPacked; } @@ -1702,7 +1730,9 @@ ConfigureContent( != TCL_OK) { return TCL_ERROR; } - containerPtr = GetPacker(other); + if (!(containerPtr = GetPacker(other))) { + continue; + } prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { @@ -1785,7 +1815,9 @@ ConfigureContent( */ if (!positionGiven) { - containerPtr = GetPacker(Tk_Parent(content)); + if (!(containerPtr = GetPacker(Tk_Parent(content)))) { + continue; + } prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { |