From a8d8152bcfcdacd4b0a55d00a657e61191178db8 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Thu, 12 Jun 2008 20:19:27 +0000 Subject: * 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. --- ChangeLog | 7 +++++++ generic/tclCmdIL.c | 27 ++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8708e46..27b5b16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-12 Andreas Kupries + + * 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. + 2008-06-12 Daniel Steffen * unix/Makefile.in: add complete deps on tclDTrace.h. 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; } -- cgit v0.12