Avoid duplicate object handle assignment on creation.
This commit is contained in:
parent
9c694f07b3
commit
3ca0bff246
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue