1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix SDL_Texture double free (#10156)

Double freeing of SDL_Texture caused assertion failure when calling
HardwareDisplayDrawingEngine::SetVSync. According to SDL documentation,
SDL_DestroyRenderer frees the associated textures.
This commit is contained in:
Krisztián Csordás
2019-10-28 20:43:22 +01:00
committed by Michał Janiszewski
parent 2d443b591f
commit 8f7c95e425

View File

@@ -62,14 +62,6 @@ public:
~HardwareDisplayDrawingEngine() override
{
if (_screenTexture != nullptr)
{
SDL_DestroyTexture(_screenTexture);
}
if (_scaledScreenTexture != nullptr)
{
SDL_DestroyTexture(_scaledScreenTexture);
}
SDL_FreeFormat(_screenTextureFormat);
SDL_DestroyRenderer(_sdlRenderer);
}
@@ -85,6 +77,8 @@ public:
{
_useVsync = vsync;
SDL_DestroyRenderer(_sdlRenderer);
_screenTexture = nullptr;
_scaledScreenTexture = nullptr;
Initialise();
Resize(_uiContext->GetWidth(), _uiContext->GetHeight());
}