diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index caf3c2a2cc..19c9997b14 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -76,8 +76,8 @@ private: float _gestureRadius; public: - UiContext(IPlatformUiContext * platformUiContext) - : _platformUiContext(platformUiContext) + UiContext() + : _platformUiContext(CreatePlatformUiContext()) { if (SDL_Init(SDL_INIT_VIDEO) < 0) { @@ -90,6 +90,7 @@ public: { CloseWindow(); SDL_QuitSubSystem(SDL_INIT_VIDEO); + delete _platformUiContext; } // Window @@ -604,6 +605,5 @@ private: IUiContext * OpenRCT2::Ui::CreateUiContext() { - auto platformUiContext = std::unique_ptr(CreatePlatformUiContext()); - return new UiContext(platformUiContext.get()); + return new UiContext(); }