diff --git a/tcl/mfinterp.tcl.in b/tcl/mfinterp.tcl.in index e8c26f68..dccaa7d8 100644 --- a/tcl/mfinterp.tcl.in +++ b/tcl/mfinterp.tcl.in @@ -219,7 +219,8 @@ proc execute-modulefile {modfile modname modnamevrvar modspec {up_namevr 1}\ lpopState modulefile knerror [getStickyUnloadMsg super-sticky] } elseif {[isModuleTagged $modname sticky 1] && [currentState\ - reloading_sticky] ne $modname} { + reloading_sticky] ne $modname && [currentState unloading_sticky] ne\ + $modname} { if {[getState force]} { reportWarning [getStickyForcedUnloadMsg] } else { diff --git a/tcl/subcmd.tcl.in b/tcl/subcmd.tcl.in index aa5a9048..65d34d32 100644 --- a/tcl/subcmd.tcl.in +++ b/tcl/subcmd.tcl.in @@ -647,17 +647,14 @@ proc cmdModuleRestore {args} { } else { set modvr $mod } - if {[set sticky_reload [isStickinessReloading $modvr $mod_to_load]]} { - lappendState reloading_sticky $mod - } + # sticky modules can be unloaded when restoring collection + lappendState unloading_sticky $mod if {[set supersticky_reload [isStickinessReloading $modvr $mod_to_load\ super-sticky]]} { lappendState reloading_supersticky $mod } cmdModuleUnload unload match 0 0 0 0 $mod - if {$sticky_reload} { - lpopState reloading_sticky - } + lpopState unloading_sticky if {$supersticky_reload} { lpopState reloading_supersticky }