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
1 changed files with 2 additions and 8 deletions

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());
}