Remove modules from the object table if they fail to load.
This commit is contained in:
parent
3e6c70defa
commit
2855036f72
|
@ -303,13 +303,18 @@ object_ref<UserModule> KernelState::LoadUserModule(const char* raw_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global_lock.unlock();
|
||||||
|
|
||||||
// Module wasn't loaded, so load it.
|
// Module wasn't loaded, so load it.
|
||||||
module = object_ref<UserModule>(new UserModule(this, path.c_str()));
|
module = object_ref<UserModule>(new UserModule(this, path.c_str()));
|
||||||
X_STATUS status = module->LoadFromFile(path);
|
X_STATUS status = module->LoadFromFile(path);
|
||||||
if (XFAILED(status)) {
|
if (XFAILED(status)) {
|
||||||
|
object_table()->RemoveHandle(module->handle());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global_lock.lock();
|
||||||
|
|
||||||
// Retain when putting into the listing.
|
// Retain when putting into the listing.
|
||||||
module->Retain();
|
module->Retain();
|
||||||
user_modules_.push_back(module);
|
user_modules_.push_back(module);
|
||||||
|
|
Loading…
Reference in New Issue