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) {
|
X_STATUS ObjectTable::AddHandle(XObject* object, X_HANDLE* out_handle) {
|
||||||
assert_not_null(out_handle);
|
|
||||||
|
|
||||||
X_STATUS result = X_STATUS_SUCCESS;
|
X_STATUS result = X_STATUS_SUCCESS;
|
||||||
|
|
||||||
uint32_t handle = 0;
|
uint32_t handle = 0;
|
||||||
|
@ -123,7 +121,9 @@ X_STATUS ObjectTable::AddHandle(XObject* object, X_HANDLE* out_handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XSUCCEEDED(result)) {
|
if (XSUCCEEDED(result)) {
|
||||||
*out_handle = handle;
|
if (out_handle) {
|
||||||
|
*out_handle = handle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -42,9 +42,7 @@ XObject::XObject(KernelState* kernel_state, Type type)
|
||||||
|
|
||||||
// TODO: Assert kernel_state != nullptr in this constructor.
|
// TODO: Assert kernel_state != nullptr in this constructor.
|
||||||
if (kernel_state) {
|
if (kernel_state) {
|
||||||
X_HANDLE handle;
|
kernel_state->object_table()->AddHandle(this, nullptr);
|
||||||
kernel_state->object_table()->AddHandle(this, &handle);
|
|
||||||
handles_[0] = handle;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue