Reset contexts before calling LoadHook
If more than one loadhooks exist, calls to CreateModule will make an error because the contexts object isn't reset and the same modules are added more than once. This fixes the bug by initializing contexts object every time. Bug: 213297238 Test: manual Change-Id: I545c1592c3217b764968a8937c962e9d58a85291
This commit is contained in:
parent
a08e722192
commit
1e01a4e7c2
1 changed files with 8 additions and 8 deletions
|
@ -1368,16 +1368,16 @@ func runAndRemoveLoadHooks(ctx *Context, config interface{}, module *moduleInfo,
|
|||
|
||||
if v, exists := pendingHooks.Load(module.logicModule); exists {
|
||||
hooks := v.(*[]LoadHook)
|
||||
mctx := &loadHookContext{
|
||||
baseModuleContext: baseModuleContext{
|
||||
context: ctx,
|
||||
config: config,
|
||||
module: module,
|
||||
},
|
||||
scopedModuleFactories: scopedModuleFactories,
|
||||
}
|
||||
|
||||
for _, hook := range *hooks {
|
||||
mctx := &loadHookContext{
|
||||
baseModuleContext: baseModuleContext{
|
||||
context: ctx,
|
||||
config: config,
|
||||
module: module,
|
||||
},
|
||||
scopedModuleFactories: scopedModuleFactories,
|
||||
}
|
||||
hook(mctx)
|
||||
newModules = append(newModules, mctx.newModules...)
|
||||
deps = append(deps, mctx.ninjaFileDeps...)
|
||||
|
|
Loading…
Reference in a new issue