diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-10-20 14:37:17 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-10-20 14:37:17 (GMT) |
| commit | ead276c0000ccd74d54004a0ba0d5d9f9ad31a38 (patch) | |
| tree | 89dd5227e2bca08d08c10b9211a1f6c325e9f9fa /generic/tclBasic.c | |
| parent | ab5335a4c951b478bbedd4f5561b8a314da5b074 (diff) | |
| parent | 37aa42f79dede55e98bf0684b0163c11dfa27f81 (diff) | |
| download | tcl-ead276c0000ccd74d54004a0ba0d5d9f9ad31a38.zip tcl-ead276c0000ccd74d54004a0ba0d5d9f9ad31a38.tar.gz tcl-ead276c0000ccd74d54004a0ba0d5d9f9ad31a38.tar.bz2 | |
Resolver fix from Stefan Sobernig.
* generic/tclLiteral.c (TclInvalidateCmdLiteral): [Bug 3418547]:
Additional code for handling the invalidation of literals.
* generic/tclBasic.c (Tcl_CreateObjCommand, Tcl_CreateCommand)
(TclRenameCommand, Tcl_ExposeCommand): The four additional places that
need extra care when dealing with literals.
* generic/tclTest.c (TestInterpResolverCmd): Additional test machinery
for interpreter resolvers.
Diffstat (limited to 'generic/tclBasic.c')
| -rw-r--r-- | generic/tclBasic.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 9758449..d10e8e6 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1922,6 +1922,17 @@ Tcl_ExposeCommand( } /* + * Command resolvers (per-interp, per-namespace) might have resolved to a + * command for the given namespace scope with this command not being + * registered with the namespace's command table. During BC compilation, + * the so-resolved command turns into a CmdName literal. Without + * invalidating a possible CmdName literal here explicitly, such literals + * keep being reused while pointing to overhauled commands. + */ + + TclInvalidateCmdLiteral(interp, cmdName, nsPtr); + + /* * The list of command exported from the namespace might have changed. * However, we do not need to recompute this just yet; next time we need * the info will be soon enough. @@ -2069,6 +2080,18 @@ Tcl_CreateCommand( } } else { /* + * Command resolvers (per-interp, per-namespace) might have resolved + * to a command for the given namespace scope with this command not + * being registered with the namespace's command table. During BC + * compilation, the so-resolved command turns into a CmdName literal. + * Without invalidating a possible CmdName literal here explicitly, + * such literals keep being reused while pointing to overhauled + * commands. + */ + + TclInvalidateCmdLiteral(interp, tail, nsPtr); + + /* * The list of command exported from the namespace might have changed. * However, we do not need to recompute this just yet; next time we * need the info will be soon enough. @@ -2242,6 +2265,18 @@ Tcl_CreateObjCommand( } } else { /* + * Command resolvers (per-interp, per-namespace) might have resolved + * to a command for the given namespace scope with this command not + * being registered with the namespace's command table. During BC + * compilation, the so-resolved command turns into a CmdName literal. + * Without invalidating a possible CmdName literal here explicitly, + * such literals keep being reused while pointing to overhauled + * commands. + */ + + TclInvalidateCmdLiteral(interp, tail, nsPtr); + + /* * The list of command exported from the namespace might have changed. * However, we do not need to recompute this just yet; next time we * need the info will be soon enough. @@ -2551,6 +2586,17 @@ TclRenameCommand( TclInvalidateNsCmdLookup(cmdPtr->nsPtr); /* + * Command resolvers (per-interp, per-namespace) might have resolved to a + * command for the given namespace scope with this command not being + * registered with the namespace's command table. During BC compilation, + * the so-resolved command turns into a CmdName literal. Without + * invalidating a possible CmdName literal here explicitly, such literals + * keep being reused while pointing to overhauled commands. + */ + + TclInvalidateCmdLiteral(interp, newTail, cmdPtr->nsPtr); + + /* * Script for rename traces can delete the command "oldName". Therefore * increment the reference count for cmdPtr so that it's Command structure * is freed only towards the end of this function by calling |
