diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index 9a1cb4415..22b8b50ff 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -27,13 +27,19 @@ namespace xe { namespace kernel { +XObject::XObject(Type type) + : kernel_state_(nullptr), pointer_ref_count_(1), type_(type) { + handles_.reserve(10); +} + XObject::XObject(KernelState* kernel_state, Type type) : kernel_state_(kernel_state), pointer_ref_count_(1), - type_(type), guest_object_ptr_(0), allocated_guest_object_(false) { - handles_.reserve(10); + XObject::XObject(type); + + // TODO: Assert kernel_state != nullptr in this constructor. if (kernel_state) { X_HANDLE handle; kernel_state->object_table()->AddHandle(this, &handle); diff --git a/src/xenia/kernel/xobject.h b/src/xenia/kernel/xobject.h index 3175ed786..b5f31379d 100644 --- a/src/xenia/kernel/xobject.h +++ b/src/xenia/kernel/xobject.h @@ -125,6 +125,7 @@ class XObject { kTypeTimer, }; + XObject(Type type); XObject(KernelState* kernel_state, Type type); virtual ~XObject(); @@ -223,8 +224,8 @@ class XObject { // Guest pointer for kernel object. Remember: X_OBJECT_HEADER precedes this // if we allocated it! - uint32_t guest_object_ptr_; - bool allocated_guest_object_; + uint32_t guest_object_ptr_ = 0; + bool allocated_guest_object_ = false; }; template