diff options
author | griffin <briang42@easystreet.net> | 2021-03-09 01:16:36 (GMT) |
---|---|---|
committer | griffin <briang42@easystreet.net> | 2021-03-09 01:16:36 (GMT) |
commit | 30cbe7c9a25fd9d16a74523fdcd39c4ee12a883f (patch) | |
tree | 2edea807985b8c823fafdb8476e5ffe00a1833c3 /generic | |
parent | 3579b12d6cb4df3e757916696eefabd3a57e9c00 (diff) | |
download | tk-30cbe7c9a25fd9d16a74523fdcd39c4ee12a883f.zip tk-30cbe7c9a25fd9d16a74523fdcd39c4ee12a883f.tar.gz tk-30cbe7c9a25fd9d16a74523fdcd39c4ee12a883f.tar.bz2 |
propsed fix for lost "update" command after "destroy ."
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkWindow.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 2a98876..ac36440 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -199,6 +199,8 @@ static const TkCmd commands[] = { {NULL, NULL, 0} }; +static Tcl_CmdInfo *saveTclUpdateCmd = NULL; +static Tcl_ObjCmdProc *updateObjProc = NULL; /* * Forward declarations to functions defined later in this file: */ @@ -915,6 +917,8 @@ TkCreateMainWindow( isSafe = Tcl_IsSafe(interp); for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { + Tcl_CmdInfo cmdInfo; + if (cmdPtr->objProc == NULL) { Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } @@ -934,6 +938,13 @@ TkCreateMainWindow( } else { clientData = NULL; } + if (Tcl_GetCommandInfo(interp, cmdPtr->name, &cmdInfo)) { + if (cmdInfo.isNativeObjectProc && saveTclUpdateCmd == NULL) { + saveTclUpdateCmd = ckalloc(sizeof (Tcl_CmdInfo)); + *saveTclUpdateCmd = cmdInfo; + updateObjProc = cmdInfo.objProc; + } + } if (cmdPtr->flags & USEINITPROC) { ((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData); } else { @@ -1496,13 +1507,19 @@ Tk_DestroyWindow( */ if ((winPtr->mainPtr->interp != NULL) && - !Tcl_InterpDeleted(winPtr->mainPtr->interp)) { + !Tcl_InterpDeleted(winPtr->mainPtr->interp)) { for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { - Tcl_CreateObjCommand(winPtr->mainPtr->interp, cmdPtr->name, - TkDeadAppObjCmd, NULL, NULL); + if (saveTclUpdateCmd && updateObjProc && + cmdPtr->objProc == Tk_UpdateObjCmd) { + Tcl_CreateObjCommand(winPtr->mainPtr->interp, + cmdPtr->name, updateObjProc, + NULL, NULL); + } else { + Tcl_CreateObjCommand(winPtr->mainPtr->interp, + cmdPtr->name, TkDeadAppObjCmd, + NULL, NULL); + } } - Tcl_CreateObjCommand(winPtr->mainPtr->interp, "send", - TkDeadAppObjCmd, NULL, NULL); Tcl_UnlinkVar(winPtr->mainPtr->interp, "tk_strictMotif"); Tcl_UnlinkVar(winPtr->mainPtr->interp, "::tk::AlwaysShowSelection"); |