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:
parent
aa29ed9aa1
commit
6749e47f61
|
@ -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) {
|
||||||
|
delete module;
|
||||||
|
module = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// "get" the module
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
module->Get();
|
module->Get();
|
||||||
*infop = module->Info();
|
*infop = module->Info();
|
||||||
} else
|
|
||||||
delete module;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
|
Loading…
Reference in New Issue