result BadaAppForm::Construct() { result r = Form::Construct(Controls::FORM_STYLE_NORMAL); if (IsFailed(r)) { return r; } BadaSystem* badaSystem = null; _gameThread = null; badaSystem = new BadaSystem(this); r = badaSystem != null ? E_SUCCESS : E_OUT_OF_MEMORY; if (!IsFailed(r)) { r = badaSystem->Construct(); } if (!IsFailed(r)) { _gameThread = new Thread(); r = _gameThread != null ? E_SUCCESS : E_OUT_OF_MEMORY; } if (!IsFailed(r)) { r = _gameThread->Construct(*this); } if (IsFailed(r)) { if (badaSystem != null) { delete badaSystem; } if (_gameThread != null) { delete _gameThread; _gameThread = null; } } else { g_system = badaSystem; } return r; }