diff options
author | andreas_kupries <akupries@shaw.ca> | 2008-06-12 20:19:27 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2008-06-12 20:19:27 (GMT) |
commit | a8d8152bcfcdacd4b0a55d00a657e61191178db8 (patch) | |
tree | 9c56eeb9ebb3bcf2a1bd3de875df67dc8539b3c4 /generic/tclCmdIL.c | |
parent | e4f4c57260ec61ec4684b6f3658d3cfe4879be02 (diff) | |
download | tcl-a8d8152bcfcdacd4b0a55d00a657e61191178db8.zip tcl-a8d8152bcfcdacd4b0a55d00a657e61191178db8.tar.gz tcl-a8d8152bcfcdacd4b0a55d00a657e61191178db8.tar.bz2 |
* generic/tclCmdIL.c (InfoFrameCmd): TIP #280 conditional
feature. Added checks to validate HashEntry and HashTable
information gotten from Command structures. This seems to be
needed to handle structures managed by Itcl.
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index eae2d10..d7f1d5b 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.12 2007/12/05 14:54:08 dkf Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.13 2008/06/12 20:19:29 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1202,17 +1202,26 @@ InfoFrameCmd(dummy, interp, objc, objv) lv [lc ++] = Tcl_NewStringObj (f.cmd.str.cmd, f.cmd.str.len); if (procPtr != NULL) { - Tcl_HashEntry* namePtr = procPtr->cmdPtr->hPtr; - char* procName = Tcl_GetHashKey (namePtr->tablePtr, namePtr); - char* nsName = procPtr->cmdPtr->nsPtr->fullName; + Tcl_HashEntry* namePtr = procPtr->cmdPtr->hPtr; + /* + * ITcl seems to provide us with weird, maybe bogus + * Command structures (methods?) which may have no + * HashEntry pointing to the name information, or a + * HashEntry without owning HashTable. Therefore check + * again that our data is valid. + */ + if (namePtr && namePtr->tablePtr) { + char* procName = Tcl_GetHashKey (namePtr->tablePtr, namePtr); + char* nsName = procPtr->cmdPtr->nsPtr->fullName; - lv [lc ++] = Tcl_NewStringObj ("proc",-1); - lv [lc ++] = Tcl_NewStringObj (nsName,-1); + lv [lc ++] = Tcl_NewStringObj ("proc",-1); + lv [lc ++] = Tcl_NewStringObj (nsName,-1); - if (strcmp (nsName, "::") != 0) { - Tcl_AppendToObj (lv [lc-1], "::", -1); + if (strcmp (nsName, "::") != 0) { + Tcl_AppendToObj (lv [lc-1], "::", -1); + } + Tcl_AppendToObj (lv [lc-1], procName, -1); } - Tcl_AppendToObj (lv [lc-1], procName, -1); } break; } |