Fixed bug in ModuleManager::GetModule(): The module pointer was not returned, when the module was already loaded.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2291 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2002-12-23 23:05:12 +00:00
parent aa29ed9aa1
commit 6749e47f61
1 changed files with 9 additions and 4 deletions

View File

@ -286,15 +286,20 @@ ModuleManager::GetModule(const char *path, module_info **infop)
BAutolock _lock(fModules); BAutolock _lock(fModules);
Module *module = fModules.FindModule(path); Module *module = fModules.FindModule(path);
if (!module) { if (!module) {
// module not yet loaded, try to get it
module = new Module; module = new Module;
error = module->Init(path); error = module->Init(path);
if (error == B_OK && !fModules.AddModule(module)) if (error == B_OK && !fModules.AddModule(module))
error = B_NO_MEMORY; error = B_NO_MEMORY;
if (error == B_OK) { if (error != B_OK) {
module->Get();
*infop = module->Info();
} else
delete module; delete module;
module = NULL;
}
}
// "get" the module
if (error == B_OK) {
module->Get();
*infop = module->Info();
} }
} }
return error; return error;