Modules using object_ref.

This commit is contained in:
Ben Vanik
2015-05-24 20:44:27 -07:00
parent fff1a7c132
commit 5cfb69434c
11 changed files with 63 additions and 94 deletions

View File

@@ -171,13 +171,12 @@ XboxkrnlModule::~XboxkrnlModule() {
int XboxkrnlModule::LaunchModule(const char* path) {
// Create and register the module. We keep it local to this function and
// dispose it on exit.
XUserModule* module = new XUserModule(kernel_state_, path);
auto module = object_ref<XUserModule>(new XUserModule(kernel_state_, path));
// Load the module into memory from the filesystem.
X_STATUS result_code = module->LoadFromFile(path);
if (XFAILED(result_code)) {
XELOGE("Failed to load module %s: %.8X", path, result_code);
module->Release();
return 1;
}
@@ -193,12 +192,9 @@ int XboxkrnlModule::LaunchModule(const char* path) {
kernel_state_->SetExecutableModule(NULL);
if (XFAILED(result_code)) {
XELOGE("Failed to launch module %s: %.8X", path, result_code);
module->Release();
return 2;
}
module->Release();
return 0;
}