From 3ca0bff24651488b2ab7e1b1e28fe7cc5724f455 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Tue, 29 Dec 2015 14:03:23 -0800 Subject: [PATCH] Avoid duplicate object handle assignment on creation. --- src/xenia/kernel/util/object_table.cc | 6 +++--- src/xenia/kernel/xobject.cc | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/xenia/kernel/util/object_table.cc b/src/xenia/kernel/util/object_table.cc index c71b345c1..6ccd63b26 100644 --- a/src/xenia/kernel/util/object_table.cc +++ b/src/xenia/kernel/util/object_table.cc @@ -96,8 +96,6 @@ bool ObjectTable::Resize(uint32_t new_capacity) { } X_STATUS ObjectTable::AddHandle(XObject* object, X_HANDLE* out_handle) { - assert_not_null(out_handle); - X_STATUS result = X_STATUS_SUCCESS; uint32_t handle = 0; @@ -123,7 +121,9 @@ X_STATUS ObjectTable::AddHandle(XObject* object, X_HANDLE* out_handle) { } if (XSUCCEEDED(result)) { - *out_handle = handle; + if (out_handle) { + *out_handle = handle; + } } return result; diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index fa3dd4cff..bd27409d7 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -42,9 +42,7 @@ XObject::XObject(KernelState* kernel_state, Type type) // TODO: Assert kernel_state != nullptr in this constructor. if (kernel_state) { - X_HANDLE handle; - kernel_state->object_table()->AddHandle(this, &handle); - handles_[0] = handle; + kernel_state->object_table()->AddHandle(this, nullptr); } }