1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix premature deletion of platform context

This commit is contained in:
Ted John
2017-03-29 19:37:56 +01:00
committed by Gymnasiast
parent 0440c3deea
commit a020a9fbef

View File

@@ -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<IPlatformUiContext>(CreatePlatformUiContext());
return new UiContext(platformUiContext.get());
return new UiContext();
}